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

Fri, 14 Mar 2014 23:03:03 -0700

author
asaha
date
Fri, 14 Mar 2014 23:03:03 -0700
changeset 2343
a84f7aa5d1d5
parent 0
959103a6100f
permissions
-rw-r--r--

Merge

     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