2 Replies Latest reply on Oct 12, 2004 9:41 PM by 843829

    Inner class native methods


      I have an inner class in an interface like this:
      pubic interface Outer
          void blah();
          public class Inner extends Bridgeable
              final native private long native_construct(Outer outer);
              public long getLong(Outer outer)
                  //this call gives an unsatisfiedlinkerror (even when the library is confirmed as loaded)
                  return construct(outer);
      Well, "native_construct" is a native method which I had expected to be either accessible as:

      JNIEXPORT jlong JNICALL Java_Outer_Inner_Native_1construct(JNIEnv *jpEnv, jobject jObjRef, jobject jOuter)

      or maybe (although I have to admit I didn't expect the $ to compile!):

      JNIEXPORT jlong JNICALL Java_Outer$Inner_Native_1construct(JNIEnv *jpEnv, jobject jObjRef, jobject jOuter)

      Neither of these are excessible from the interfaces inner class however. So the questions are:
      Am I being stupid and just not got the syntax right?
      Can inner classes (static or non-static) access native methods like this?
      Is this problem just because it's in an interface?
      Is this a bug in JNI?

      This is a fairly important point for us, as I was planning on using this approach for some automatically generated code we use.