am 58de514b: Merge "Fix Class.getDex."
* commit '58de514b160674a483bcb912d367072c7354cc1e':
Fix Class.getDex.
diff --git a/vm/Init.cpp b/vm/Init.cpp
index d5b4989..9c4ee48 100644
--- a/vm/Init.cpp
+++ b/vm/Init.cpp
@@ -1627,6 +1627,20 @@
// 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");
diff --git a/vm/native/java_lang_Class.cpp b/vm/native/java_lang_Class.cpp
index 88d31ef..e68be7b 100644
--- a/vm/native/java_lang_Class.cpp
+++ b/vm/native/java_lang_Class.cpp
@@ -785,7 +785,7 @@
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;
}