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

Mon, 24 Oct 2011 13:00:30 +0100

author
mcimadamore
date
Mon, 24 Oct 2011 13:00:30 +0100
changeset 1114
05814303a056
parent 384
ed31953ca025
child 2525
2eb010b6cb22
permissions
-rw-r--r--

7098660: Write better overload resolution/inference tests
Summary: Add overload/inference debug diagnostics - added test harness using annotations to check outcome of overload resolution/inference
Reviewed-by: jjg

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