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