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

Mon, 16 Sep 2013 14:13:44 +0200

author
jlahoda
date
Mon, 16 Sep 2013 14:13:44 +0200
changeset 2028
4ce8148ffc4f
parent 0
959103a6100f
permissions
-rw-r--r--

8021112: Spurious unchecked warning reported by javac
6480588: No way to suppress deprecation warnings when implementing deprecated interface
Summary: Fixing DeferredLintHandler configuration, so lint warnings are reported with correct @SuppressWarnings settings
Reviewed-by: jjg, vromero

     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 }

mercurial