author | twisti |
Mon, 27 Apr 2015 09:02:41 -0700 | |
changeset 30288 | 476c276de939 |
parent 22219 | 4bfd5df70189 |
permissions | -rw-r--r-- |
21067
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
1 |
/* |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
4 |
* |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
8 |
* |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
13 |
* accompanied this code). |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
14 |
* |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
18 |
* |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
21 |
* questions. |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
22 |
*/ |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
23 |
|
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
24 |
/* |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
25 |
* @test |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
26 |
* @bug 8024804 |
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
21912
diff
changeset
|
27 |
* @bug 8028741 |
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
21912
diff
changeset
|
28 |
* @summary interface method resolution should skip finding j.l.Object's registerNatives() and succeed in selecting class B's registerNatives() |
21067
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
29 |
* @run main RegisterNatives |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
30 |
*/ |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
31 |
public class RegisterNatives { |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
32 |
interface I { void registerNatives(); } |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
33 |
interface J extends I {} |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
34 |
static class B implements J { public void registerNatives() { System.out.println("B"); } } |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
35 |
public static void main(String... args) { |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
36 |
System.out.println("Regression test for JDK-8024804, crash when InterfaceMethodref resolves to Object.registerNatives\n"); |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
37 |
J val = new B(); |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
38 |
try { |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
39 |
val.registerNatives(); |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
40 |
} catch (IllegalAccessError e) { |
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
21912
diff
changeset
|
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"); |
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
21912
diff
changeset
|
42 |
e.printStackTrace(); |
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
21912
diff
changeset
|
43 |
throw e; |
21067
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
44 |
} |
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
21912
diff
changeset
|
45 |
System.out.println("TEST PASSES - no IAE resulted\n"); |
21067
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
46 |
} |
5288d9ba4f49
8024804: Crash when InterfaceMethodref resolves to Object.registerNatives
hseigel
parents:
diff
changeset
|
47 |
} |