author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 42074 | hotspot/test/runtime/ConstantPool/TestMethodHandleConstant.java@c069e5e285cb |
permissions | -rw-r--r-- |
39398
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
1 |
/* |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
4 |
* |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
8 |
* |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
13 |
* accompanied this code). |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
14 |
* |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
18 |
* |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
21 |
* questions. |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
22 |
*/ |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
23 |
|
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
24 |
/* |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
25 |
* @test |
42074
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
39398
diff
changeset
|
26 |
* @bug 8159470 8166974 |
39398
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
27 |
* @summary Test that MethodHandle constants are checked |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
28 |
* @modules java.base/jdk.internal.misc |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
29 |
* @compile WithConfiguration.jcod |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
30 |
* @run main/othervm TestMethodHandleConstant |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
31 |
*/ |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
32 |
public class TestMethodHandleConstant { |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
33 |
|
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
34 |
public static void main(String[] args) { |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
35 |
try { |
42074
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
39398
diff
changeset
|
36 |
// This interface has bad constant pool entry for MethodHandle -> Method |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
39398
diff
changeset
|
37 |
String URI_DEFAULT |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
39398
diff
changeset
|
38 |
= WithConfiguration.autoDetect().getLocation(); |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
39398
diff
changeset
|
39 |
throw new RuntimeException("FAILED, IncompatibleClassChangeError not thrown"); |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
39398
diff
changeset
|
40 |
} |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
39398
diff
changeset
|
41 |
catch (IncompatibleClassChangeError icce) { |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
39398
diff
changeset
|
42 |
System.out.println("PASSED, expecting IncompatibleClassChangeError" + icce.getMessage()); |
39398
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
43 |
} |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
44 |
} |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
45 |
} |
16b3ed4012f8
8159470: Error message for ICCE for MethodHandle constant pool not helpful
coleenp
parents:
diff
changeset
|
46 |