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

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 }

mercurial