Fix FindFieldID to use class's classloader to find field type.
Also includes a test case, though the test case does not recreate
this exact issue because the attached native thread would need to
have a null context classloader.
Bug: 11737351
Change-Id: Ieb7536702a556485d667361124cd7985b712b093
diff --git a/test/JniTest/JniTest.java b/test/JniTest/JniTest.java
index a1b1f0c..9194da5 100644
--- a/test/JniTest/JniTest.java
+++ b/test/JniTest/JniTest.java
@@ -20,12 +20,24 @@
public static void main(String[] args) {
System.loadLibrary("arttest");
testFindClassOnAttachedNativeThread();
+ testFindFieldOnAttachedNativeThread();
testCallStaticVoidMethodOnSubClass();
testGetMirandaMethod();
}
private static native void testFindClassOnAttachedNativeThread();
+ private static boolean testFindFieldOnAttachedNativeThreadField;
+
+ private static void testFindFieldOnAttachedNativeThread() {
+ testFindFieldOnAttachedNativeThreadNative();
+ if (!testFindFieldOnAttachedNativeThreadField) {
+ throw new AssertionError();
+ }
+ }
+
+ private static native void testFindFieldOnAttachedNativeThreadNative();
+
private static void testCallStaticVoidMethodOnSubClass() {
testCallStaticVoidMethodOnSubClassNative();
if (!testCallStaticVoidMethodOnSubClass_SuperClass.executed) {