OSDN Git Service

Merge "Fix Class.getDex."
authorElliott Hughes <enh@google.com>
Wed, 31 Jul 2013 17:47:22 +0000 (17:47 +0000)
committerThe Android Automerger <android-build@android.com>
Thu, 1 Aug 2013 21:44:33 +0000 (14:44 -0700)
vm/Init.cpp
vm/native/java_lang_Class.cpp

index d5b4989..9c4ee48 100644 (file)
@@ -1627,6 +1627,20 @@ static bool registerSystemNatives(JNIEnv* pEnv)
     // First set up JniConstants, which is used by libcore.
     JniConstants::init(pEnv);
 
+    // Set up our single JNI method.
+    // TODO: factor this out if we add more.
+    jclass c = pEnv->FindClass("java/lang/Class");
+    if (c == NULL) {
+        dvmAbort();
+    }
+    JNIEXPORT jobject JNICALL Java_java_lang_Class_getDex(JNIEnv* env, jclass javaClass);
+    const JNINativeMethod Java_java_lang_Class[] = {
+        { "getDex", "()Lcom/android/dex/Dex;", (void*) Java_java_lang_Class_getDex },
+    };
+    if (pEnv->RegisterNatives(c, Java_java_lang_Class, 1) != JNI_OK) {
+        dvmAbort();
+    }
+
     // Most JNI libraries can just use System.loadLibrary, but you can't
     // if you're the library that implements System.loadLibrary!
     loadJniLibrary("javacore");
index 88d31ef..e68be7b 100644 (file)
@@ -785,7 +785,7 @@ JNIEXPORT jobject JNICALL Java_java_lang_Class_getDex(JNIEnv* env, jclass javaCl
 
     jmethodID com_android_dex_Dex_create =
             env->GetStaticMethodID(com_android_dex_Dex,
-                                   "<init>", "(Ljava/nio/ByteBuffer;)Lcom/android/dex/Dex;");
+                                   "create", "(Ljava/nio/ByteBuffer;)Lcom/android/dex/Dex;");
     if (com_android_dex_Dex_create == NULL) {
         return NULL;
     }