author | serb |
Tue, 12 Nov 2013 20:24:25 +0400 | |
changeset 21596 | 0e3a39f29dbc |
parent 9730 | e4b334d47f4b |
child 40684 | 2e37c119dc2a |
permissions | -rw-r--r-- |
8821
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
1 |
/* |
8822
8145ab9f5f86
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
8821
diff
changeset
|
2 |
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. |
8821
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
4 |
* |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
8 |
* |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
13 |
* accompanied this code). |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
14 |
* |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
18 |
* |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
21 |
* questions. |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
22 |
* |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
23 |
*/ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
24 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
25 |
/** |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
26 |
* @test |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
27 |
* @bug 6991596 |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
28 |
* @summary JSR 292 unimplemented adapter_opt_i2i and adapter_opt_l2i on SPARC |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
29 |
* |
9033
a88f5656f05d
6817525: turn on method handle functionality by default for JSR 292
jrose
parents:
8822
diff
changeset
|
30 |
* @run main/othervm -ea -XX:+UnlockDiagnosticVMOptions -XX:+VerifyMethodHandles Test6991596 |
8821
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
31 |
*/ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
32 |
|
8822
8145ab9f5f86
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
8821
diff
changeset
|
33 |
import java.lang.invoke.*; |
8821
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
34 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
35 |
public class Test6991596 { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
36 |
private static final Class CLASS = Test6991596.class; |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
37 |
private static final String NAME = "foo"; |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
38 |
private static final boolean DEBUG = System.getProperty("DEBUG", "false").equals("true"); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
39 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
40 |
public static void main(String[] args) throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
41 |
testboolean(); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
42 |
testbyte(); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
43 |
testchar(); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
44 |
testshort(); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
45 |
testint(); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
46 |
testlong(); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
47 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
48 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
49 |
// Helpers to get various methods. |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
50 |
static MethodHandle getmh1(Class ret, Class arg) throws ReflectiveOperationException { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
51 |
return MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(ret, arg)); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
52 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
53 |
static MethodHandle getmh2(MethodHandle mh1, Class ret, Class arg) { |
9730
e4b334d47f4b
7032850: MethodHandle.invokeGeneric throws unspecified RuntimeException if parameterized method is called
jrose
parents:
9033
diff
changeset
|
54 |
return MethodHandles.explicitCastArguments(mh1, MethodType.methodType(ret, arg)); |
8821
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
55 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
56 |
static MethodHandle getmh3(MethodHandle mh1, Class ret, Class arg) { |
9730
e4b334d47f4b
7032850: MethodHandle.invokeGeneric throws unspecified RuntimeException if parameterized method is called
jrose
parents:
9033
diff
changeset
|
57 |
return MethodHandles.explicitCastArguments(mh1, MethodType.methodType(ret, arg)); |
8821
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
58 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
59 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
60 |
// test adapter_opt_i2i |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
61 |
static void testboolean() throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
62 |
boolean[] a = new boolean[] { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
63 |
true, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
64 |
false |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
65 |
}; |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
66 |
for (int i = 0; i < a.length; i++) { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
67 |
doboolean(a[i]); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
68 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
69 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
70 |
static void doboolean(boolean x) throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
71 |
if (DEBUG) System.out.println("boolean=" + x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
72 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
73 |
// boolean |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
74 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
75 |
MethodHandle mh1 = getmh1( boolean.class, boolean.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
76 |
MethodHandle mh2 = getmh2(mh1, boolean.class, boolean.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
77 |
// TODO add this for all cases when the bugs are fixed. |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
78 |
//MethodHandle mh3 = getmh3(mh1, boolean.class, boolean.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
79 |
boolean a = (boolean) mh1.invokeExact((boolean) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
80 |
boolean b = (boolean) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
81 |
//boolean c = mh3.<boolean>invokeExact((boolean) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
82 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
83 |
//check(x, c, x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
84 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
85 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
86 |
// byte |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
87 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
88 |
MethodHandle mh1 = getmh1( byte.class, byte.class ); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
89 |
MethodHandle mh2 = getmh2(mh1, byte.class, boolean.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
90 |
byte a = (byte) mh1.invokeExact((byte) (x ? 1 : 0)); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
91 |
byte b = (byte) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
92 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
93 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
94 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
95 |
// char |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
96 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
97 |
MethodHandle mh1 = getmh1( char.class, char.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
98 |
MethodHandle mh2 = getmh2(mh1, char.class, boolean.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
99 |
char a = (char) mh1.invokeExact((char) (x ? 1 : 0)); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
100 |
char b = (char) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
101 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
102 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
103 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
104 |
// short |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
105 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
106 |
MethodHandle mh1 = getmh1( short.class, short.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
107 |
MethodHandle mh2 = getmh2(mh1, short.class, boolean.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
108 |
short a = (short) mh1.invokeExact((short) (x ? 1 : 0)); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
109 |
short b = (short) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
110 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
111 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
112 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
113 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
114 |
static void testbyte() throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
115 |
byte[] a = new byte[] { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
116 |
Byte.MIN_VALUE, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
117 |
Byte.MIN_VALUE + 1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
118 |
-0x0F, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
119 |
-1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
120 |
0, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
121 |
1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
122 |
0x0F, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
123 |
Byte.MAX_VALUE - 1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
124 |
Byte.MAX_VALUE |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
125 |
}; |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
126 |
for (int i = 0; i < a.length; i++) { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
127 |
dobyte(a[i]); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
128 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
129 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
130 |
static void dobyte(byte x) throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
131 |
if (DEBUG) System.out.println("byte=" + x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
132 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
133 |
// boolean |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
134 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
135 |
MethodHandle mh1 = getmh1( boolean.class, boolean.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
136 |
MethodHandle mh2 = getmh2(mh1, boolean.class, byte.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
137 |
boolean a = (boolean) mh1.invokeExact((x & 1) == 1); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
138 |
boolean b = (boolean) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
139 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
140 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
141 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
142 |
// byte |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
143 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
144 |
MethodHandle mh1 = getmh1( byte.class, byte.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
145 |
MethodHandle mh2 = getmh2(mh1, byte.class, byte.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
146 |
byte a = (byte) mh1.invokeExact((byte) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
147 |
byte b = (byte) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
148 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
149 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
150 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
151 |
// char |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
152 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
153 |
MethodHandle mh1 = getmh1( char.class, char.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
154 |
MethodHandle mh2 = getmh2(mh1, char.class, byte.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
155 |
char a = (char) mh1.invokeExact((char) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
156 |
char b = (char) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
157 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
158 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
159 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
160 |
// short |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
161 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
162 |
MethodHandle mh1 = getmh1( short.class, short.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
163 |
MethodHandle mh2 = getmh2(mh1, short.class, byte.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
164 |
short a = (short) mh1.invokeExact((short) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
165 |
short b = (short) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
166 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
167 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
168 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
169 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
170 |
static void testchar() throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
171 |
char[] a = new char[] { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
172 |
Character.MIN_VALUE, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
173 |
Character.MIN_VALUE + 1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
174 |
0x000F, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
175 |
0x00FF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
176 |
0x0FFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
177 |
Character.MAX_VALUE - 1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
178 |
Character.MAX_VALUE |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
179 |
}; |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
180 |
for (int i = 0; i < a.length; i++) { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
181 |
dochar(a[i]); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
182 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
183 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
184 |
static void dochar(char x) throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
185 |
if (DEBUG) System.out.println("char=" + x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
186 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
187 |
// boolean |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
188 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
189 |
MethodHandle mh1 = getmh1( boolean.class, boolean.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
190 |
MethodHandle mh2 = getmh2(mh1, boolean.class, char.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
191 |
boolean a = (boolean) mh1.invokeExact((x & 1) == 1); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
192 |
boolean b = (boolean) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
193 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
194 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
195 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
196 |
// byte |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
197 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
198 |
MethodHandle mh1 = getmh1( byte.class, byte.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
199 |
MethodHandle mh2 = getmh2(mh1, byte.class, char.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
200 |
byte a = (byte) mh1.invokeExact((byte) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
201 |
byte b = (byte) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
202 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
203 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
204 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
205 |
// char |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
206 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
207 |
MethodHandle mh1 = getmh1( char.class, char.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
208 |
MethodHandle mh2 = getmh2(mh1, char.class, char.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
209 |
char a = (char) mh1.invokeExact((char) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
210 |
char b = (char) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
211 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
212 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
213 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
214 |
// short |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
215 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
216 |
MethodHandle mh1 = getmh1( short.class, short.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
217 |
MethodHandle mh2 = getmh2(mh1, short.class, char.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
218 |
short a = (short) mh1.invokeExact((short) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
219 |
short b = (short) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
220 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
221 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
222 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
223 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
224 |
static void testshort() throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
225 |
short[] a = new short[] { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
226 |
Short.MIN_VALUE, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
227 |
Short.MIN_VALUE + 1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
228 |
-0x0FFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
229 |
-0x00FF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
230 |
-0x000F, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
231 |
-1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
232 |
0, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
233 |
1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
234 |
0x000F, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
235 |
0x00FF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
236 |
0x0FFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
237 |
Short.MAX_VALUE - 1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
238 |
Short.MAX_VALUE |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
239 |
}; |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
240 |
for (int i = 0; i < a.length; i++) { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
241 |
doshort(a[i]); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
242 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
243 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
244 |
static void doshort(short x) throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
245 |
if (DEBUG) System.out.println("short=" + x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
246 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
247 |
// boolean |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
248 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
249 |
MethodHandle mh1 = getmh1( boolean.class, boolean.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
250 |
MethodHandle mh2 = getmh2(mh1, boolean.class, short.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
251 |
boolean a = (boolean) mh1.invokeExact((x & 1) == 1); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
252 |
boolean b = (boolean) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
253 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
254 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
255 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
256 |
// byte |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
257 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
258 |
MethodHandle mh1 = getmh1( byte.class, byte.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
259 |
MethodHandle mh2 = getmh2(mh1, byte.class, short.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
260 |
byte a = (byte) mh1.invokeExact((byte) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
261 |
byte b = (byte) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
262 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
263 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
264 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
265 |
// char |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
266 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
267 |
MethodHandle mh1 = getmh1( char.class, char.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
268 |
MethodHandle mh2 = getmh2(mh1, char.class, short.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
269 |
char a = (char) mh1.invokeExact((char) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
270 |
char b = (char) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
271 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
272 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
273 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
274 |
// short |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
275 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
276 |
MethodHandle mh1 = getmh1( short.class, short.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
277 |
MethodHandle mh2 = getmh2(mh1, short.class, short.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
278 |
short a = (short) mh1.invokeExact((short) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
279 |
short b = (short) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
280 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
281 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
282 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
283 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
284 |
static void testint() throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
285 |
int[] a = new int[] { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
286 |
Integer.MIN_VALUE, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
287 |
Integer.MIN_VALUE + 1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
288 |
-0x0FFFFFFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
289 |
-0x00FFFFFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
290 |
-0x000FFFFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
291 |
-0x0000FFFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
292 |
-0x00000FFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
293 |
-0x000000FF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
294 |
-0x0000000F, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
295 |
-1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
296 |
0, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
297 |
1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
298 |
0x0000000F, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
299 |
0x000000FF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
300 |
0x00000FFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
301 |
0x0000FFFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
302 |
0x000FFFFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
303 |
0x00FFFFFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
304 |
0x0FFFFFFF, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
305 |
Integer.MAX_VALUE - 1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
306 |
Integer.MAX_VALUE |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
307 |
}; |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
308 |
for (int i = 0; i < a.length; i++) { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
309 |
doint(a[i]); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
310 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
311 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
312 |
static void doint(int x) throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
313 |
if (DEBUG) System.out.println("int=" + x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
314 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
315 |
// boolean |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
316 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
317 |
MethodHandle mh1 = getmh1( boolean.class, boolean.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
318 |
MethodHandle mh2 = getmh2(mh1, boolean.class, int.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
319 |
boolean a = (boolean) mh1.invokeExact((x & 1) == 1); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
320 |
boolean b = (boolean) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
321 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
322 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
323 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
324 |
// byte |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
325 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
326 |
MethodHandle mh1 = getmh1( byte.class, byte.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
327 |
MethodHandle mh2 = getmh2(mh1, byte.class, int.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
328 |
byte a = (byte) mh1.invokeExact((byte) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
329 |
byte b = (byte) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
330 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
331 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
332 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
333 |
// char |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
334 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
335 |
MethodHandle mh1 = getmh1( char.class, char.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
336 |
MethodHandle mh2 = getmh2(mh1, char.class, int.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
337 |
char a = (char) mh1.invokeExact((char) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
338 |
char b = (char) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
339 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
340 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
341 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
342 |
// short |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
343 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
344 |
MethodHandle mh1 = getmh1( short.class, short.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
345 |
MethodHandle mh2 = getmh2(mh1, short.class, int.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
346 |
short a = (short) mh1.invokeExact((short) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
347 |
short b = (short) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
348 |
assert a == b : a + " != " + b; |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
349 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
350 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
351 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
352 |
// int |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
353 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
354 |
MethodHandle mh1 = getmh1( int.class, int.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
355 |
MethodHandle mh2 = getmh2(mh1, int.class, int.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
356 |
int a = (int) mh1.invokeExact((int) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
357 |
int b = (int) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
358 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
359 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
360 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
361 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
362 |
// test adapter_opt_l2i |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
363 |
static void testlong() throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
364 |
long[] a = new long[] { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
365 |
Long.MIN_VALUE, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
366 |
Long.MIN_VALUE + 1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
367 |
-0x000000000FFFFFFFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
368 |
-0x0000000000FFFFFFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
369 |
-0x00000000000FFFFFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
370 |
-0x000000000000FFFFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
371 |
-0x0000000000000FFFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
372 |
-0x00000000000000FFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
373 |
-0x000000000000000FL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
374 |
-1L, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
375 |
0L, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
376 |
1L, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
377 |
0x000000000000000FL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
378 |
0x00000000000000FFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
379 |
0x0000000000000FFFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
380 |
0x0000000000000FFFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
381 |
0x000000000000FFFFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
382 |
0x00000000000FFFFFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
383 |
0x0000000000FFFFFFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
384 |
0x000000000FFFFFFFL, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
385 |
Long.MAX_VALUE - 1, |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
386 |
Long.MAX_VALUE |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
387 |
}; |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
388 |
for (int i = 0; i < a.length; i++) { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
389 |
dolong(a[i]); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
390 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
391 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
392 |
static void dolong(long x) throws Throwable { |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
393 |
if (DEBUG) System.out.println("long=" + x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
394 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
395 |
// boolean |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
396 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
397 |
MethodHandle mh1 = getmh1( boolean.class, boolean.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
398 |
MethodHandle mh2 = getmh2(mh1, boolean.class, long.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
399 |
boolean a = (boolean) mh1.invokeExact((x & 1L) == 1L); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
400 |
boolean b = (boolean) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
401 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
402 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
403 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
404 |
// byte |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
405 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
406 |
MethodHandle mh1 = getmh1( byte.class, byte.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
407 |
MethodHandle mh2 = getmh2(mh1, byte.class, long.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
408 |
byte a = (byte) mh1.invokeExact((byte) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
409 |
byte b = (byte) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
410 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
411 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
412 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
413 |
// char |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
414 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
415 |
MethodHandle mh1 = getmh1( char.class, char.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
416 |
MethodHandle mh2 = getmh2(mh1, char.class, long.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
417 |
char a = (char) mh1.invokeExact((char) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
418 |
char b = (char) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
419 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
420 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
421 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
422 |
// short |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
423 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
424 |
MethodHandle mh1 = getmh1( short.class, short.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
425 |
MethodHandle mh2 = getmh2(mh1, short.class, long.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
426 |
short a = (short) mh1.invokeExact((short) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
427 |
short b = (short) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
428 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
429 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
430 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
431 |
// int |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
432 |
{ |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
433 |
MethodHandle mh1 = getmh1( int.class, int.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
434 |
MethodHandle mh2 = getmh2(mh1, int.class, long.class); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
435 |
int a = (int) mh1.invokeExact((int) x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
436 |
int b = (int) mh2.invokeExact(x); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
437 |
check(x, a, b); |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
438 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
439 |
} |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
440 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
441 |
static void check(boolean x, boolean e, boolean a) { p(z2h(x), z2h(e), z2h(a)); assert e == a : z2h(x) + ": " + z2h(e) + " != " + z2h(a); } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
442 |
static void check(boolean x, byte e, byte a) { p(z2h(x), i2h(e), i2h(a)); assert e == a : z2h(x) + ": " + i2h(e) + " != " + i2h(a); } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
443 |
static void check(boolean x, int e, int a) { p(z2h(x), i2h(e), i2h(a)); assert e == a : z2h(x) + ": " + i2h(e) + " != " + i2h(a); } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
444 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
445 |
static void check(int x, boolean e, boolean a) { p(i2h(x), z2h(e), z2h(a)); assert e == a : i2h(x) + ": " + z2h(e) + " != " + z2h(a); } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
446 |
static void check(int x, byte e, byte a) { p(i2h(x), i2h(e), i2h(a)); assert e == a : i2h(x) + ": " + i2h(e) + " != " + i2h(a); } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
447 |
static void check(int x, int e, int a) { p(i2h(x), i2h(e), i2h(a)); assert e == a : i2h(x) + ": " + i2h(e) + " != " + i2h(a); } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
448 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
449 |
static void check(long x, boolean e, boolean a) { p(l2h(x), z2h(e), z2h(a)); assert e == a : l2h(x) + ": " + z2h(e) + " != " + z2h(a); } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
450 |
static void check(long x, byte e, byte a) { p(l2h(x), i2h(e), i2h(a)); assert e == a : l2h(x) + ": " + i2h(e) + " != " + i2h(a); } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
451 |
static void check(long x, int e, int a) { p(l2h(x), i2h(e), i2h(a)); assert e == a : l2h(x) + ": " + i2h(e) + " != " + i2h(a); } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
452 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
453 |
static void p(String x, String e, String a) { if (DEBUG) System.out.println(x + ": expected: " + e + ", actual: " + a); } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
454 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
455 |
static String z2h(boolean x) { return x ? "1" : "0"; } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
456 |
static String i2h(int x) { return Integer.toHexString(x); } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
457 |
static String l2h(long x) { return Long.toHexString(x); } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
458 |
|
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
459 |
// to int |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
460 |
public static boolean foo(boolean i) { return i; } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
461 |
public static byte foo(byte i) { return i; } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
462 |
public static char foo(char i) { return i; } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
463 |
public static short foo(short i) { return i; } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
464 |
public static int foo(int i) { return i; } |
2836ee97ee27
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff
changeset
|
465 |
} |