Skip to content

Generator broken for jbyteArray return type #82

@thedeadliestcatch

Description

@thedeadliestcatch

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.

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