test/tools/javac/generics/rare/6665356/T6665356.java

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

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

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

mcimadamore@185 1 /*
jjg@384 2 * @test /nodynamiccopyright/
mcimadamore@185 3 * @author Maurizio Cimadamore
mcimadamore@185 4 * @bug 6665356
mcimadamore@185 5 * @summary Cast not allowed when both qualifying type and inner class are parameterized
mcimadamore@185 6 * @compile/fail/ref=T6665356.out -XDrawDiagnostics T6665356.java
mcimadamore@185 7 */
mcimadamore@185 8
mcimadamore@185 9 class T6665356 {
mcimadamore@185 10 class Outer<S> {
mcimadamore@185 11 class Inner<T> {}
mcimadamore@185 12 }
mcimadamore@185 13
mcimadamore@185 14 void test1() {
mcimadamore@185 15 boolean b;
mcimadamore@185 16 b = null instanceof Outer.Inner;
mcimadamore@185 17 b = null instanceof Outer<?>.Inner;
mcimadamore@185 18 b = null instanceof Outer.Inner<?>;
mcimadamore@185 19 b = null instanceof Outer<?>.Inner<?>;
mcimadamore@185 20 }
mcimadamore@185 21
mcimadamore@185 22 void test2() {
mcimadamore@185 23 boolean b;
mcimadamore@185 24 Object o;
mcimadamore@185 25 o = (Outer.Inner)null;
mcimadamore@185 26 o = (Outer<?>.Inner)null;
mcimadamore@185 27 o = (Outer.Inner<?>)null;
mcimadamore@185 28 o = (Outer<?>.Inner<?>)null;
mcimadamore@185 29 }
jjg@384 30 }

mercurial