Mercurial > hg > graal-compiler
annotate test/runtime/lambda-features/TestInterfaceOrder.java @ 21656:e49a0ebb2659
AMD64HotSpotRegisterAllocationConfig: adhere to the register order specified by -G:RegisterPressure.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 02 Jun 2015 10:23:19 +0200 |
parents | 90257dfad6e3 |
children |
rev | line source |
---|---|
20576
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
1 /* |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
4 * |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
8 * |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
13 * accompanied this code). |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
14 * |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
18 * |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
21 * questions. |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
22 * |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
23 */ |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
24 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
25 /* |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
26 * @test |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
27 * @bug 8034275 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
28 * @summary [JDK 8u40] Test interface initialization order |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
29 * @run main TestInterfaceOrder |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
30 */ |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
31 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
32 import java.util.List; |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
33 import java.util.Arrays; |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
34 import java.util.ArrayList; |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
35 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
36 public class TestInterfaceOrder { |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
37 static List<Class<?>> cInitOrder = new ArrayList<>(); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
38 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
39 public static void main(java.lang.String[] args) { |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
40 //Trigger initialization |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
41 C c = new C(); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
42 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
43 List<Class<?>> expectedCInitOrder = Arrays.asList(I.class, J.class, A.class, K.class, B.class, L.class, C.class); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
44 if (!cInitOrder.equals(expectedCInitOrder)) { |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
45 throw new RuntimeException(String.format("Class initialization order %s not equal to expected order %s", cInitOrder, expectedCInitOrder)); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
46 } |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
47 } |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
48 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
49 interface I { |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
50 boolean v = TestInterfaceOrder.out(I.class); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
51 default void i() {} |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
52 } |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
53 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
54 interface J extends I { |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
55 boolean v = TestInterfaceOrder.out(J.class); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
56 default void j() {} |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
57 } |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
58 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
59 static class A implements J { |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
60 static boolean v = TestInterfaceOrder.out(A.class); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
61 } |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
62 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
63 interface K extends I { |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
64 boolean v = TestInterfaceOrder.out(K.class); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
65 default void k() {} |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
66 } |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
67 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
68 static class B extends A implements K { |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
69 static boolean v = TestInterfaceOrder.out(B.class); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
70 } |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
71 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
72 interface L { |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
73 boolean v = TestInterfaceOrder.out(L.class); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
74 default void l() {} |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
75 } |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
76 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
77 static class C extends B implements L { |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
78 static boolean v = TestInterfaceOrder.out(C.class); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
79 } |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
80 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
81 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
82 static boolean out(Class c) { |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
83 System.out.println("#: initializing " + c.getName()); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
84 cInitOrder.add(c); |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
85 return true; |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
86 } |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
87 |
90257dfad6e3
8043275: 8u40 backport: Fix interface initialization for default methods.
acorn
parents:
diff
changeset
|
88 } |