Avoid a case of eager initialization.
Don't mark as initialized classes that contain static field
initialization.
Change-Id: Iedcabbdf355e8861eb7731650eee1467f68ae0cd
diff --git a/src/jni_internal.cc b/src/jni_internal.cc
index 949217b..c5ffec1 100644
--- a/src/jni_internal.cc
+++ b/src/jni_internal.cc
@@ -331,7 +331,7 @@
static jmethodID FindMethodID(ScopedJniThreadState& ts, jclass jni_class, const char* name, const char* sig, bool is_static) {
Class* c = Decode<Class*>(ts, jni_class);
- if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(c, true)) {
+ if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(c, true, true)) {
return NULL;
}
@@ -366,7 +366,7 @@
static jfieldID FindFieldID(ScopedJniThreadState& ts, jclass jni_class, const char* name, const char* sig, bool is_static) {
Class* c = Decode<Class*>(ts, jni_class);
- if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(c, true)) {
+ if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(c, true, true)) {
return NULL;
}
@@ -966,7 +966,7 @@
static jobject AllocObject(JNIEnv* env, jclass java_class) {
ScopedJniThreadState ts(env);
Class* c = Decode<Class*>(ts, java_class);
- if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(c, true)) {
+ if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(c, true, true)) {
return NULL;
}
return AddLocalReference<jobject>(env, c->AllocObject());
@@ -984,7 +984,7 @@
static jobject NewObjectV(JNIEnv* env, jclass java_class, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
Class* c = Decode<Class*>(ts, java_class);
- if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(c, true)) {
+ if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(c, true, true)) {
return NULL;
}
Object* result = c->AllocObject();
@@ -1003,7 +1003,7 @@
static jobject NewObjectA(JNIEnv* env, jclass java_class, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
Class* c = Decode<Class*>(ts, java_class);
- if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(c, true)) {
+ if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(c, true, true)) {
return NULL;
}
Object* result = c->AllocObject();
@@ -2898,7 +2898,7 @@
// If this is a static method, it could be called before the class
// has been initialized.
if (m->IsStatic()) {
- if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(c, true)) {
+ if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(c, true, true)) {
return NULL;
}
} else {