Wed, 26 Jan 2011 13:45:25 -0800
7013272: Automatically generate info about how compiler resource keys are used
Reviewed-by: mcimadamore
1 /*
2 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
24 /*
25 * @test
26 * @bug 6348760
27 * @summary crash: java.lang.AssertionError at com.sun.tools.javac.comp.Lower.abstractLval(Lower.java:1853)
28 * @author Peter von der Ah\u00e9
29 * @run main/othervm -Xfuture T6348760
30 */
32 public class T6348760<T> {
33 T value;
34 static int n;
36 T6348760(T value) {
37 this.value = value;
38 }
40 static void testByte(T6348760<Byte> i, T6348760<Byte> j, T6348760<Boolean> a) {
41 i.value++;
42 i.value--;
43 ++i.value;
44 --i.value;
45 n = +i.value;
46 n = -i.value;
47 n = ~i.value;
48 n = i.value * j.value;
49 n = i.value / j.value;
50 n = i.value % j.value;
51 n = i.value + j.value;
52 n = i.value - j.value;
53 n = i.value << j.value;
54 n = i.value >> j.value;
55 n = i.value >>> j.value;
56 n = i.value & j.value;
57 n = i.value ^ j.value;
58 n = i.value | j.value;
59 n *= j.value;
60 n /= j.value;
61 n %= j.value;
62 n += j.value;
63 n -= j.value;
64 n <<= j.value;
65 n >>= j.value;
66 n >>>= j.value;
67 n &= j.value;
68 n ^= j.value;
69 n |= j.value;
70 a.value = i.value < j.value;
71 a.value = i.value > j.value;
72 a.value = i.value <= j.value;
73 a.value = i.value >= j.value;
74 a.value = i.value == j.value;
75 a.value = i.value != j.value;
76 }
78 static void testShort(T6348760<Short> i, T6348760<Short> j, T6348760<Boolean> a) {
79 i.value++;
80 i.value--;
81 ++i.value;
82 --i.value;
83 n = +i.value;
84 n = -i.value;
85 n = ~i.value;
86 n = i.value * j.value;
87 n = i.value / j.value;
88 n = i.value % j.value;
89 n = i.value + j.value;
90 n = i.value - j.value;
91 n = i.value << j.value;
92 n = i.value >> j.value;
93 n = i.value >>> j.value;
94 n = i.value & j.value;
95 n = i.value ^ j.value;
96 n = i.value | j.value;
97 n *= j.value;
98 n /= j.value;
99 n %= j.value;
100 n += j.value;
101 n -= j.value;
102 n <<= j.value;
103 n >>= j.value;
104 n >>>= j.value;
105 n &= j.value;
106 n ^= j.value;
107 n |= j.value;
108 a.value = i.value < j.value;
109 a.value = i.value > j.value;
110 a.value = i.value <= j.value;
111 a.value = i.value >= j.value;
112 a.value = i.value == j.value;
113 a.value = i.value != j.value;
114 }
116 static void testInteger(T6348760<Integer> i, T6348760<Integer> j, T6348760<Boolean> a) {
117 i.value++;
118 i.value--;
119 ++i.value;
120 --i.value;
121 i.value = +i.value;
122 i.value = -i.value;
123 i.value = ~i.value;
124 i.value = i.value * j.value;
125 i.value = i.value / j.value;
126 i.value = i.value % j.value;
127 i.value = i.value + j.value;
128 i.value = i.value - j.value;
129 i.value = i.value << j.value;
130 i.value = i.value >> j.value;
131 i.value = i.value >>> j.value;
132 i.value = i.value & j.value;
133 i.value = i.value ^ j.value;
134 i.value = i.value | j.value;
135 i.value *= j.value;
136 i.value /= j.value;
137 i.value %= j.value;
138 i.value += j.value;
139 i.value -= j.value;
140 i.value <<= j.value;
141 i.value >>= j.value;
142 i.value >>>= j.value;
143 i.value &= j.value;
144 i.value ^= j.value;
145 i.value |= j.value;
146 a.value = i.value < j.value;
147 a.value = i.value > j.value;
148 a.value = i.value <= j.value;
149 a.value = i.value >= j.value;
150 a.value = i.value == j.value;
151 a.value = i.value != j.value;
152 }
154 static void testLong(T6348760<Long> i, T6348760<Long> j, T6348760<Boolean> a) {
155 i.value++;
156 i.value--;
157 ++i.value;
158 --i.value;
159 i.value = +i.value;
160 i.value = -i.value;
161 i.value = ~i.value;
162 i.value = i.value * j.value;
163 i.value = i.value / j.value;
164 i.value = i.value % j.value;
165 i.value = i.value + j.value;
166 i.value = i.value - j.value;
167 i.value = i.value << j.value;
168 i.value = i.value >> j.value;
169 i.value = i.value >>> j.value;
170 i.value = i.value & j.value;
171 i.value = i.value ^ j.value;
172 i.value = i.value | j.value;
173 i.value *= j.value;
174 i.value /= j.value;
175 i.value %= j.value;
176 i.value += j.value;
177 i.value -= j.value;
178 i.value <<= j.value;
179 i.value >>= j.value;
180 i.value >>>= j.value;
181 i.value &= j.value;
182 i.value ^= j.value;
183 i.value |= j.value;
184 a.value = i.value < j.value;
185 a.value = i.value > j.value;
186 a.value = i.value <= j.value;
187 a.value = i.value >= j.value;
188 a.value = i.value == j.value;
189 a.value = i.value != j.value;
190 }
192 static void testCharacter(T6348760<Character> i, T6348760<Character> j, T6348760<Boolean> a) {
193 i.value++;
194 i.value--;
195 ++i.value;
196 --i.value;
197 n = +i.value;
198 n = -i.value;
199 n = ~i.value;
200 n = i.value * j.value;
201 n = i.value / j.value;
202 n = i.value % j.value;
203 n = i.value + j.value;
204 n = i.value - j.value;
205 n = i.value << j.value;
206 n = i.value >> j.value;
207 n = i.value >>> j.value;
208 n = i.value & j.value;
209 n = i.value ^ j.value;
210 n = i.value | j.value;
211 n *= j.value;
212 n /= j.value;
213 n %= j.value;
214 n += j.value;
215 n -= j.value;
216 n <<= j.value;
217 n >>= j.value;
218 n >>>= j.value;
219 n &= j.value;
220 n ^= j.value;
221 n |= j.value;
222 a.value = i.value < j.value;
223 a.value = i.value > j.value;
224 a.value = i.value <= j.value;
225 a.value = i.value >= j.value;
226 a.value = i.value == j.value;
227 a.value = i.value != j.value;
228 }
230 static void testFloat(T6348760<Float> i, T6348760<Float> j, T6348760<Boolean> a) {
231 i.value++;
232 i.value--;
233 ++i.value;
234 --i.value;
235 i.value = +i.value;
236 i.value = -i.value;
237 // i.value = ~i.value;
238 i.value = i.value * j.value;
239 i.value = i.value / j.value;
240 i.value = i.value % j.value;
241 i.value = i.value + j.value;
242 i.value = i.value - j.value;
243 // i.value = i.value << j.value;
244 // i.value = i.value >> j.value;
245 // i.value = i.value >>> j.value;
246 // i.value = i.value & j.value;
247 // i.value = i.value ^ j.value;
248 // i.value = i.value | j.value;
249 i.value *= j.value;
250 i.value /= j.value;
251 i.value %= j.value;
252 i.value += j.value;
253 i.value -= j.value;
254 // i.value <<= j.value;
255 // i.value >>= j.value;
256 // i.value >>>= j.value;
257 // i.value &= j.value;
258 // i.value ^= j.value;
259 // i.value |= j.value;
260 a.value = i.value < j.value;
261 a.value = i.value > j.value;
262 a.value = i.value <= j.value;
263 a.value = i.value >= j.value;
264 a.value = i.value == j.value;
265 a.value = i.value != j.value;
266 }
268 static void testDouble(T6348760<Double> i, T6348760<Double> j, T6348760<Boolean> a) {
269 i.value++;
270 i.value--;
271 ++i.value;
272 --i.value;
273 i.value = +i.value;
274 i.value = -i.value;
275 // i.value = ~i.value;
276 i.value = i.value * j.value;
277 i.value = i.value / j.value;
278 i.value = i.value % j.value;
279 i.value = i.value + j.value;
280 i.value = i.value - j.value;
281 // i.value = i.value << j.value;
282 // i.value = i.value >> j.value;
283 // i.value = i.value >>> j.value;
284 // i.value = i.value & j.value;
285 // i.value = i.value ^ j.value;
286 // i.value = i.value | j.value;
287 i.value *= j.value;
288 i.value /= j.value;
289 i.value %= j.value;
290 i.value += j.value;
291 i.value -= j.value;
292 // i.value <<= j.value;
293 // i.value >>= j.value;
294 // i.value >>>= j.value;
295 // i.value &= j.value;
296 // i.value ^= j.value;
297 // i.value |= j.value;
298 a.value = i.value < j.value;
299 a.value = i.value > j.value;
300 a.value = i.value <= j.value;
301 a.value = i.value >= j.value;
302 a.value = i.value == j.value;
303 a.value = i.value != j.value;
304 }
306 static void testBoolean(T6348760<Boolean> i, T6348760<Boolean> j, T6348760<Boolean> a) {
307 // i.value++;
308 // i.value--;
309 // ++i.value;
310 // --i.value;
311 // i.value = +i.value;
312 // i.value = -i.value;
313 // i.value = ~i.value;
314 // i.value = i.value * j.value;
315 // i.value = i.value / j.value;
316 // i.value = i.value % j.value;
317 // i.value = i.value + j.value;
318 // i.value = i.value - j.value;
319 // i.value = i.value << j.value;
320 // i.value = i.value >> j.value;
321 // i.value = i.value >>> j.value;
322 i.value = i.value & j.value;
323 i.value = i.value ^ j.value;
324 i.value = i.value | j.value;
325 // i.value *= j.value;
326 // i.value /= j.value;
327 // i.value %= j.value;
328 // i.value += j.value;
329 // i.value -= j.value;
330 // i.value <<= j.value;
331 // i.value >>= j.value;
332 // i.value >>>= j.value;
333 i.value &= j.value;
334 i.value ^= j.value;
335 i.value |= j.value;
336 // a.value = i.value < j.value;
337 // a.value = i.value > j.value;
338 // a.value = i.value <= j.value;
339 // a.value = i.value >= j.value;
340 a.value = i.value == j.value;
341 a.value = i.value != j.value;
342 a.value = !j.value;
343 a.value = i.value && j.value;
344 a.value = i.value || j.value;
345 }
348 public static void main(String... args) {
349 testByte (new T6348760<Byte>((byte)42),
350 new T6348760<Byte>((byte)42),
351 new T6348760<Boolean>(true));
352 testShort (new T6348760<Short>((short)42),
353 new T6348760<Short>((short)42),
354 new T6348760<Boolean>(true));
355 testInteger (new T6348760<Integer>(42),
356 new T6348760<Integer>(42),
357 new T6348760<Boolean>(true));
358 testLong (new T6348760<Long>(42L),
359 new T6348760<Long>(42L),
360 new T6348760<Boolean>(true));
361 testCharacter(new T6348760<Character>('*'),
362 new T6348760<Character>('*'),
363 new T6348760<Boolean>(true));
364 testFloat (new T6348760<Float>(42.0F),
365 new T6348760<Float>(42.0F),
366 new T6348760<Boolean>(true));
367 testDouble (new T6348760<Double>(42.0D),
368 new T6348760<Double>(42.0D),
369 new T6348760<Boolean>(true));
370 testBoolean (new T6348760<Boolean>(true),
371 new T6348760<Boolean>(true),
372 new T6348760<Boolean>(true));
373 }
374 }