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.
Oops, I answered my own question. The jclass object represents the class of args, so its methods are those of the class of args, not those of java.lang.Class. I was misinterpreting what GetMethodID does -- it gets methods that would be returned by getMethods() in the Class object, not the methods of the Class object.