Fix wrong handling of Generic JNI not finding native method.

Code did not properly call JNIMethodEnd, such that locks etc
where not correctly handled.

Add a test case to jni_compiler_test.

Change-Id: If2d5c628517d65a56dd6bb5c4cabdff77c7664a1
diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc
index 3204282..a0797f3 100644
--- a/compiler/jni/jni_compiler_test.cc
+++ b/compiler/jni/jni_compiler_test.cc
@@ -1268,4 +1268,14 @@
   env_->CallNonvirtualVoidMethodA(jobj_, jklass_, jmethod_, args);
 }
 
+TEST_F(JniCompilerTest, WithoutImplementation) {
+  TEST_DISABLED_FOR_PORTABLE();
+  SetUpForTest(false, "withoutImplementation", "()V", nullptr);
+
+  env_->CallVoidMethod(jobj_, jmethod_);
+
+  EXPECT_TRUE(Thread::Current()->IsExceptionPending());
+  EXPECT_TRUE(env_->ExceptionCheck() == JNI_TRUE);
+}
+
 }  // namespace art