Implement native method return value and upcall argument type checking.
Also clean up the CheckJNI testing a bit. I still need to do some work so that
JniAbort catches more of the detail, but this is a step forward.
Change-Id: Ibf5e32867d56123cff902ebf602406b731f567d2
diff --git a/src/scoped_jni_thread_state.h b/src/scoped_jni_thread_state.h
index 552f5ed..1065a96 100644
--- a/src/scoped_jni_thread_state.h
+++ b/src/scoped_jni_thread_state.h
@@ -51,12 +51,13 @@
private:
static Thread* ThreadForEnv(JNIEnv* env) {
JNIEnvExt* full_env(reinterpret_cast<JNIEnvExt*>(env));
+ bool work_around_app_jni_bugs = full_env->vm->work_around_app_jni_bugs;
Thread* env_self = full_env->self;
- Thread* self = full_env->vm->work_around_app_jni_bugs ? Thread::Current() : env_self;
- if (self != env_self) {
- LOG(ERROR) << "JNI ERROR: JNIEnv for " << *env_self
+ Thread* self = work_around_app_jni_bugs ? Thread::Current() : env_self;
+ if (!work_around_app_jni_bugs && self != env_self) {
+ LOG(FATAL) << "JNI ERROR (app bug): JNIEnv for " << *env_self
<< " used on " << *self;
- // TODO: dump stack
+ // TODO: pass JNI function through so we can call JniAbort(function_name) instead.
}
return self;
}