test/tools/javac/cast/6714835/T6714835.java

Mon, 23 Sep 2013 17:27:38 +0400

author
kizune
date
Mon, 23 Sep 2013 17:27:38 +0400
changeset 2048
809a50f24d6f
parent 0
959103a6100f
permissions
-rw-r--r--

7154966: CRs found to be in Fixed state with no test and no noreg- keyword.
Reviewed-by: ksrini

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @author mcimadamore
     4  * @bug     6714835
     5  * @summary Safe cast is rejected (with warning) by javac
     6  * @compile/fail/ref=T6714835.out -Xlint:unchecked -Werror -XDrawDiagnostics T6714835.java
     7  */
     9 import java.util.*;
    11 class T6714835 {
    12     void cast1(Iterable<? extends Integer> x) {
    13         Collection<? extends Number> x1 = (Collection<? extends Number>)x; //ok
    14         Collection<? super Integer> x2 = (Collection<? super Integer>)x; //warn
    15     }
    17     void cast2(Iterable<? super Number> x) {
    18         Collection<? super Integer> x1 = (Collection<? super Integer>)x; //ok
    19         Collection<? extends Number> x2 = (Collection<? extends Number>)x; //warn
    20     }
    21 }

mercurial