Skip to content

Improve ergonomics of calling Java from C++ #11

@jfirebaugh

Description

@jfirebaugh

To call a Java method from C++, you currently must do quite a lot. As an example, consider Number::floatValue. You must:

  • Define class Float with a Name method returning "java/lang/Float"
  • Declare and initialize a jni::Class<Float>
  • Call GetMethod<jni::jfloat ()>(env, "floatValue") on it
  • Once you have an Object<Number> instance, do number.Call(env, method)

Ideally, you'd be able to just do number.floatValue(). Is there any way we can get closer to that?

Refs mapbox/mapbox-gl-native#8809

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions