diff options
Diffstat (limited to 'test/JniTest/JniTest.java')
-rw-r--r-- | test/JniTest/JniTest.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/JniTest/JniTest.java b/test/JniTest/JniTest.java index 7014ef9334..9194da581f 100644 --- a/test/JniTest/JniTest.java +++ b/test/JniTest/JniTest.java @@ -14,15 +14,30 @@ * limitations under the License. */ +import java.lang.reflect.Method; + class JniTest { 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) { @@ -42,4 +57,23 @@ class JniTest { private static class testCallStaticVoidMethodOnSubClass_SubClass extends testCallStaticVoidMethodOnSubClass_SuperClass { } + + private static native Method testGetMirandaMethodNative(); + + private static void testGetMirandaMethod() { + Method m = testGetMirandaMethodNative(); + if (m.getDeclaringClass() != testGetMirandaMethod_MirandaInterface.class) { + throw new AssertionError(); + } + } + + private static abstract class testGetMirandaMethod_MirandaAbstract implements testGetMirandaMethod_MirandaInterface { + public boolean inAbstract() { + return true; + } + } + + private static interface testGetMirandaMethod_MirandaInterface { + public boolean inInterface(); + } } |