Fri, 02 Nov 2012 14:35:57 -0700
7169362: JDK8: Write compiler tests for repeating annotations for JDK8
Reviewed-by: darcy, jjg
Contributed-by: sonali.goel@oracle.com
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 | } |