1 Reply Latest reply on Nov 15, 2011 5:11 PM by 803542

    Is a jclass object always a java.lang.Class object?

      In a native method, I'm receiving a jobjectArray called "args" as a parameter. I'm writing this:

      jclass cls1 = env->GetObjectClass(args);
      jmethodID mid1 = env->GetMethodID(cls1, "isArray", "()Z");

      but this returns 0, indicating there is no isArray in the jclass returned by GetObjectClass. On the other hand, this works:

      jclass cls2 = env->GetObjectClass(env->GetObjectClass(args));
      jmethodID mid2 = env->GetMethodID(cls2, "isArray", "()Z");


      When I call getMethods() (via JNI) on cls1, I get only the methods of java.lang.Object. When I do that on cls2 I get the methods of java.lang.Class.