Search for miranda methods in virtual methods instead of interface.
Also added tests that get miranda methods via reflection and jni.
Miranda methods can't be found via reflection, and have the interface
class as their declaring class when found via jni.
Bug: 11736932
Change-Id: I92b4fdf31be64269898ed2686a28dfb6008b213a
diff --git a/test/JniTest/JniTest.java b/test/JniTest/JniTest.java
index 7014ef9..a1b1f0c 100644
--- a/test/JniTest/JniTest.java
+++ b/test/JniTest/JniTest.java
@@ -14,11 +14,14 @@
* limitations under the License.
*/
+import java.lang.reflect.Method;
+
class JniTest {
public static void main(String[] args) {
System.loadLibrary("arttest");
testFindClassOnAttachedNativeThread();
testCallStaticVoidMethodOnSubClass();
+ testGetMirandaMethod();
}
private static native void testFindClassOnAttachedNativeThread();
@@ -42,4 +45,23 @@
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();
+ }
}