hotspot/test/runtime/ConstantPool/TestMethodHandleConstant.java
changeset 42074 c069e5e285cb
parent 39398 16b3ed4012f8
equal deleted inserted replaced
42073:89e056fd82cc 42074:c069e5e285cb
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8159470
    26  * @bug 8159470 8166974
    27  * @summary Test that MethodHandle constants are checked
    27  * @summary Test that MethodHandle constants are checked
    28  * @modules java.base/jdk.internal.misc
    28  * @modules java.base/jdk.internal.misc
    29  * @compile WithConfiguration.jcod
    29  * @compile WithConfiguration.jcod
    30  * @run main/othervm TestMethodHandleConstant
    30  * @run main/othervm TestMethodHandleConstant
    31  */
    31  */
    32 public class TestMethodHandleConstant {
    32 public class TestMethodHandleConstant {
    33 
    33 
    34     public static void main(String[] args) {
    34     public static void main(String[] args) {
    35         try {
    35         try {
    36           // This interface has bad constant pool entry for MethodHandle -> Method
    36             // This interface has bad constant pool entry for MethodHandle -> Method
    37           String URI_DEFAULT
    37             String URI_DEFAULT
    38             = WithConfiguration.autoDetect().getLocation();
    38                     = WithConfiguration.autoDetect().getLocation();
    39           throw new RuntimeException("FAILED, ICCE not thrown");
    39             throw new RuntimeException("FAILED, IncompatibleClassChangeError not thrown");
    40         } catch (BootstrapMethodError icce) {
    40         }
    41           System.out.println("PASSED, expecting ICCE" + icce.getMessage());
    41         catch (IncompatibleClassChangeError icce) {
       
    42             System.out.println("PASSED, expecting IncompatibleClassChangeError" + icce.getMessage());
    42         }
    43         }
    43     }
    44     }
    44 }
    45 }
    45 
    46