test/tools/javac/cast/6467183/T6467183a.java

Thu, 27 Aug 2009 11:08:27 -0700

author
jjg
date
Thu, 27 Aug 2009 11:08:27 -0700
changeset 384
ed31953ca025
parent 235
850869f70213
child 2525
2eb010b6cb22
permissions
-rw-r--r--

6875336: some tests should use /nodynamiccopyright/
Reviewed-by: darcy

mcimadamore@235 1 /*
jjg@384 2 * @test /nodynamiccopyright/
mcimadamore@235 3 * @author mcimadamore
mcimadamore@235 4 * @bug 6467183
mcimadamore@235 5 * @summary
mcimadamore@235 6 * @compile/fail/ref=T6467183a.out -Xlint:unchecked -Werror -XDrawDiagnostics T6467183a.java
mcimadamore@235 7 */
mcimadamore@235 8
mcimadamore@235 9 class T6467183a<T> {
mcimadamore@235 10
mcimadamore@235 11 class A<S> {}
mcimadamore@235 12 class B extends A<Integer> {}
mcimadamore@235 13 class C<X> extends A<X> {}
mcimadamore@235 14
mcimadamore@235 15 void cast1(B b) {
mcimadamore@235 16 Object o = (A<T>)b;
mcimadamore@235 17 }
mcimadamore@235 18
mcimadamore@235 19 void cast2(B b) {
mcimadamore@235 20 Object o = (A<? extends Number>)b;
mcimadamore@235 21 }
mcimadamore@235 22
mcimadamore@235 23 void cast3(A<Integer> a) {
mcimadamore@235 24 Object o = (C<? extends Number>)a;
mcimadamore@235 25 }
mcimadamore@235 26
mcimadamore@235 27 void cast4(A<Integer> a) {
mcimadamore@235 28 Object o = (C<? extends Integer>)a;
mcimadamore@235 29 }
mcimadamore@235 30 }

mercurial