--- a/test/hotspot/jtreg/runtime/8024804/RegisterNatives.java Wed Oct 23 18:43:18 2019 -0700
+++ b/test/hotspot/jtreg/runtime/8024804/RegisterNatives.java Thu Oct 24 09:57:29 2019 +0200
@@ -23,15 +23,27 @@
/*
* @test
- * @bug 8024804
- * @bug 8028741
+ * @bug 8024804 8028741 8232613
* @summary interface method resolution should skip finding j.l.Object's registerNatives() and succeed in selecting class B's registerNatives()
* @run main RegisterNatives
*/
public class RegisterNatives {
- interface I { void registerNatives(); }
+ interface I {
+ void registerNatives();
+ }
+
interface J extends I {}
- static class B implements J { public void registerNatives() { System.out.println("B"); } }
+
+ interface K {
+ default public void registerNatives() { System.out.println("K"); }
+ }
+
+ static class B implements J {
+ public void registerNatives() { System.out.println("B"); }
+ }
+
+ static class C implements K {}
+
public static void main(String... args) {
System.out.println("Regression test for JDK-8024804, crash when InterfaceMethodref resolves to Object.registerNatives\n");
J val = new B();
@@ -42,6 +54,14 @@
e.printStackTrace();
throw e;
}
+ C cval = new C();
+ try {
+ cval.registerNatives();
+ } catch (IllegalAccessError e) {
+ System.out.println("TEST FAILS - a default method named registerNatives should no longer be masked by removed Object.registerNatives\n");
+ e.printStackTrace();
+ throw e;
+ }
System.out.println("TEST PASSES - no IAE resulted\n");
}
}