Neg12.java revision 2868:816bd88d33a8
1/*
2 * @test /nodynamiccopyright/
3 * @bug 8062373
4 *
5 * @summary  Test diamond + anonymous classes with non-denotable types
6 * @author mcimadamore
7 * @compile/fail/ref=Neg12.out Neg12.java -XDrawDiagnostics
8 *
9 */
10
11 class Neg12 {
12    static class Foo<X> {
13        Foo(X x) {  }
14    }
15
16    static class DoubleFoo<X,Y> {
17        DoubleFoo(X x,Y y) {  }
18    }
19
20    static class TripleFoo<X,Y,Z> {
21        TripleFoo(X x,Y y,Z z) {  }
22    }
23
24    Foo<? extends Integer> fi = new Foo<>(1);
25    Foo<?> fw = new Foo<>(fi) {}; // Error.
26    Foo<?> fw1 = new Foo<>(fi); // OK.
27    Foo<? extends Double> fd = new Foo<>(3.0);
28    DoubleFoo<?,?> dw = new DoubleFoo<>(fi,fd) {}; // Error.
29    DoubleFoo<?,?> dw1 = new DoubleFoo<>(fi,fd); // OK.
30    Foo<String> fs = new Foo<>("one");
31    TripleFoo<?,?,?> tw = new TripleFoo<>(fi,fd,fs) {}; // Error.
32    TripleFoo<?,?,?> tw1 = new TripleFoo<>(fi,fd,fs); // OK.
33 }
34