GetSuperclass
jclass GetSuperclass(JNIEnv *env, jclass clazz);
If
clazz
represents any class other than the class Object
, then this function returns the object that represents the superclass of the class specified by clazz
.
If
clazz
specifies the class Object
, or clazz
represents an interface, this function returns NULL
.LINKAGE:
Index 10 in the JNIEnv interface function table.
PARAMETERS:
env
: the JNI interface pointer.clazz
: a Java class object.RETURNS:
Returns the superclass of the class represented by
clazz
, or NULL
.Example - GetSuperClass
+
+/*
+ * Class: java_lang_JNITest
+ * Method: getSuperclass
+ * Signature: (Ljava/lang/Class;)Ljava/lang/
+ */
+JNIEXPORT jobject JNICALL Java_java_lang_JNITest_
+{
+ return (*env)->GetSuperclass(env, childClazz);
+}
diff --git a/vm/jni-interface.c b/vm/jni-interface.c
index 345f000..9eb6e38 100644
--- a/vm/jni-interface.c
+++ b/vm/jni-interface.c
@@ -32,6 +32,7 @@
#include "lib/guard-page.h"
+#include "runtime/java_lang_VMClass.h"
#include "vm/call.h"
#include "vm/class.h"
#include "vm/classloader.h"
@@ -354,8 +355,7 @@ static jobject JNI_ToReflectedMethod(JNIEnv *env, jclass clazz, jmethodID method
static jclass JNI_GetSuperclass(JNIEnv *env, jclass clazz)
{
- JNI_NOT_IMPLEMENTED;
- return 0;
+ return (jclass) java_lang_VMClass_
}
static jboolean JNI_IsAssignableFrom(JNIEnv *env, jclass clazz1, jclass clazz2)
--
1.7.5.1