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

Generator broken for jbyteArray return type #82

Open
thedeadliestcatch opened this issue Sep 18, 2024 · 0 comments
Open

Generator broken for jbyteArray return type #82

thedeadliestcatch opened this issue Sep 18, 2024 · 0 comments

Comments

@thedeadliestcatch
Copy link

Suppose a wrapper like so:

  private final native byte[] get_some_bytes(JNIEnv env, @JniArg(cast = "void*") long nativep);
    public byte[] getBytes(long nativep) {
        return get_some_bytes(null, nativep);
    }

And on the wrapper side:

static jbyteArray
get_some_bytes(JNIEnv *env, void *v) {
    jbyteArray value;

    if (!v) {
        return 0;
    }

    value = (*env)->NewByteArray(env, ...);
    if (value == NULL)
        return NULL;

    (*env)->SetByteArrayRegion(env, value, 0, ..., ...);

    return value;
}

Despite the "correct" JNI typing, the following error occurs:

#error Warning: bad return type. :private final native byte[] blah.get_some_bytes(org.fusesource.hawtjni.runtime.JNIEnv,long)

After going through every reference I could find, and reading the 'clazz' implementation in hawtjni, I believe this is currently broken and not a manifestation of a problem in the source code above.

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

1 participant