Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect wrapping code #44

Open
haelix888 opened this issue Nov 22, 2018 · 1 comment
Open

Incorrect wrapping code #44

haelix888 opened this issue Nov 22, 2018 · 1 comment

Comments

@haelix888
Copy link

The code at
native_method:328 seems incorrect, why would you do std::decay_t&?

Comment mine:
auto wrapper = [field, initializer] (JNIEnv& e, Object& obj, /std::decay_t&/Args... args) // TODO why reference?

This causes wrapping of constructors to fail.

@this-kirke
Copy link

this-kirke commented Feb 16, 2019

Not a maintainer or contributor, but I've been working with this library a bit lately. My thoughts:

This is intended - there is a distinction between jni::Constructor and jni::Method. Constructors require creating a new local reference, while any objects returned from Java via a non-constructor method will already have been created.

Use jni::Class<TagType>::GetConstructor<Constructor args...>() if you have a high-level struct exposing public static const char* Name(){ return "java/class/path"; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants