Mon, 24 Oct 2011 13:00:30 +0100
7098660: Write better overload resolution/inference tests
Summary: Add overload/inference debug diagnostics - added test harness using annotations to check outcome of overload resolution/inference
Reviewed-by: jjg
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 */
9 class T7005671<X> {
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 }
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 }