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

Thu, 25 Aug 2011 17:18:25 -0700

author
schien
date
Thu, 25 Aug 2011 17:18:25 -0700
changeset 1067
f497fac86cf9
parent 0
959103a6100f
permissions
-rw-r--r--

Added tag jdk8-b02 for changeset b3c059de2a61

     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