Make sure threads allocating are in the kRunnable state
Change-Id: I55a08fcd38b3388698ef571d2d4fa9553210e197
diff --git a/src/java_lang_reflect_Field.cc b/src/java_lang_reflect_Field.cc
index a2f09e7..727866b 100644
--- a/src/java_lang_reflect_Field.cc
+++ b/src/java_lang_reflect_Field.cc
@@ -30,6 +30,7 @@
}
bool GetFieldValue(Object* o, Field* f, JValue& value, bool allow_references) {
+ ScopedThreadStateChange tsc(Thread::Current(), Thread::kRunnable);
switch (f->GetPrimitiveType()) {
case Primitive::kPrimBoolean:
value.z = f->GetBoolean(o);
@@ -187,6 +188,7 @@
}
void SetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jchar src_descriptor, const JValue& new_value) {
+ ScopedThreadStateChange tsc(Thread::Current(), Thread::kRunnable);
Field* f = DecodeField(env->FromReflectedField(javaField));
Object* o = NULL;
if (!CheckReceiver(env, javaObj, javaDeclaringClass, f, o)) {
@@ -254,6 +256,7 @@
}
void Field_setField(JNIEnv* env, jobject javaField, jobject javaObj, jclass javaDeclaringClass, jclass, jint, jboolean, jobject javaValue) {
+ ScopedThreadStateChange tsc(Thread::Current(), Thread::kRunnable);
Field* f = DecodeField(env->FromReflectedField(javaField));
// Unbox the value, if necessary.