test/tools/javac/cast/7005671/T7005671.java

changeset 0
959103a6100f
equal deleted inserted replaced
-1:000000000000 0:959103a6100f
1 /*
2 * @test /nodynamiccopyright/
3 * @author mcimadamore
4 * @bug 7005671
5 * @summary Regression: compiler accepts invalid cast from X[] to primitive array
6 * @compile/fail/ref=T7005671.out -XDrawDiagnostics T7005671.java
7 */
8
9 class T7005671<X> {
10
11 void test1() {
12 Object o1 = (X[])(byte[])null;
13 Object o2 = (X[])(short[])null;
14 Object o3 = (X[])(int[])null;
15 Object o4 = (X[])(long[])null;
16 Object o5 = (X[])(float[])null;
17 Object o6 = (X[])(double[])null;
18 Object o7 = (X[])(char[])null;
19 Object o8 = (X[])(boolean[])null;
20 }
21
22 void test2() {
23 Object o1 = (byte[])(X[])null;
24 Object o2 = (short[])(X[])null;
25 Object o3 = (int[])(X[])null;
26 Object o4 = (long[])(X[])null;
27 Object o5 = (float[])(X[])null;
28 Object o6 = (double[])(X[])null;
29 Object o7 = (char[])(X[])null;
30 Object o8 = (boolean[])(X[])null;
31 }
32 }

mercurial