hotspot/test/runtime/8024804/RegisterNatives.java
changeset 22219 4bfd5df70189
parent 21912 8d2924674592
equal deleted inserted replaced
22218:71cff6a30ec1 22219:4bfd5df70189
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @ignore 8028741
       
    26  * @test
    25  * @test
    27  * @bug 8024804
    26  * @bug 8024804
    28  * @summary registerNatives() interface resolution should receive IAE
    27  * @bug 8028741
       
    28  * @summary interface method resolution should skip finding j.l.Object's registerNatives() and succeed in selecting class B's registerNatives()
    29  * @run main RegisterNatives
    29  * @run main RegisterNatives
    30  */
    30  */
    31 public class RegisterNatives {
    31 public class RegisterNatives {
    32   interface I { void registerNatives(); }
    32   interface I { void registerNatives(); }
    33   interface J extends I {}
    33   interface J extends I {}
    36     System.out.println("Regression test for JDK-8024804, crash when InterfaceMethodref resolves to Object.registerNatives\n");
    36     System.out.println("Regression test for JDK-8024804, crash when InterfaceMethodref resolves to Object.registerNatives\n");
    37     J val = new B();
    37     J val = new B();
    38     try {
    38     try {
    39       val.registerNatives();
    39       val.registerNatives();
    40     } catch (IllegalAccessError e) {
    40     } catch (IllegalAccessError e) {
    41       System.out.println("TEST PASSES - according to current JVM spec, IAE expected\n");
    41       System.out.println("TEST FAILS - JDK 8 JVMS, static and non-public methods of j.l.Object should be ignored during interface method resolution\n");
    42       return;
    42       e.printStackTrace();
       
    43       throw e;
    43     }
    44     }
    44     System.out.println("TEST FAILS - no IAE resulted\n");
    45     System.out.println("TEST PASSES - no IAE resulted\n");
    45     System.exit(1);
       
    46   }
    46   }
    47 }
    47 }