Avoid getSuperclass being native.
Add unit test from Change Iaf3e98ed
Change-Id: Ic408d2f781a5822506c31a270eb1e61ada929c53
diff --git a/src/java_lang_Class.cc b/src/java_lang_Class.cc
index 29f1d23..ece98b3 100644
--- a/src/java_lang_Class.cc
+++ b/src/java_lang_Class.cc
@@ -342,12 +342,6 @@
return env->NewStringUTF(descriptor.c_str());
}
-jclass Class_getSuperclass(JNIEnv* env, jobject javaThis) {
- Class* c = Decode<Class*>(env, javaThis);
- Class* result = c->GetSuperClass();
- return AddLocalReference<jclass>(env, result);
-}
-
jboolean Class_isAssignableFrom(JNIEnv* env, jobject javaLhs, jclass javaRhs) {
ScopedThreadStateChange tsc(Thread::Current(), Thread::kRunnable);
Class* lhs = Decode<Class*>(env, javaLhs);
@@ -484,7 +478,6 @@
NATIVE_METHOD(Class, getDex, "()Lcom/android/dex/Dex;"),
NATIVE_METHOD(Class, getNonInnerClassModifiers, "()I"),
NATIVE_METHOD(Class, getNameNative, "()Ljava/lang/String;"),
- NATIVE_METHOD(Class, getSuperclass, "()Ljava/lang/Class;"),
NATIVE_METHOD(Class, isAssignableFrom, "(Ljava/lang/Class;)Z"),
NATIVE_METHOD(Class, isInstance, "(Ljava/lang/Object;)Z"),
NATIVE_METHOD(Class, isInterface, "()Z"),
diff --git a/src/jni_internal_test.cc b/src/jni_internal_test.cc
index fabd813..7db74a7 100644
--- a/src/jni_internal_test.cc
+++ b/src/jni_internal_test.cc
@@ -436,8 +436,11 @@
ASSERT_TRUE(object_class != NULL);
jclass string_class = env_->FindClass("java/lang/String");
ASSERT_TRUE(string_class != NULL);
+ jclass runnable_interface = env_->FindClass("java/lang/Runnable");
+ ASSERT_TRUE(runnable_interface != NULL);
ASSERT_TRUE(env_->IsSameObject(object_class, env_->GetSuperclass(string_class)));
ASSERT_TRUE(env_->GetSuperclass(object_class) == NULL);
+ ASSERT_TRUE(env_->IsSameObject(object_class, env_->GetSuperclass(runnable_interface)));
}
TEST_F(JniInternalTest, IsAssignableFrom) {