jni.hpp
jni.hpp copied to clipboard
Incorrect wrapping code
The code at native_method:328 seems incorrect, why would you do std::decay_t<Args>&?
Comment mine: auto wrapper = [field, initializer] (JNIEnv& e, Object<TagType>& obj, /std::decay_t<Args>&/Args... args) // TODO why reference?
This causes wrapping of constructors to fail.
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"; }