Wed, 14 Apr 2010 12:31:55 +0100
6939620: Switch to 'complex' diamond inference scheme
Summary: Implement new inference scheme for diamond operator that takes into account type of actual arguments supplied to constructor
Reviewed-by: jjg, darcy
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 6939620 6894753
4 *
5 * @summary Switch to 'complex' diamond inference scheme
6 * @author mcimadamore
7 * @compile/fail/ref=Neg08.out Neg08.java -XDrawDiagnostics
8 *
9 */
11 class Neg08 {
12 static class Foo<X> {
13 Foo(X x) { }
14 }
16 static class DoubleFoo<X,Y> {
17 DoubleFoo(X x,Y y) { }
18 }
20 static class TripleFoo<X,Y,Z> {
21 TripleFoo(X x,Y y,Z z) { }
22 }
24 Foo<? extends Integer> fi = new Foo<>(1);
25 Foo<?> fw = new Foo<>(fi);
26 Foo<? extends Double> fd = new Foo<>(3.0);
27 DoubleFoo<?,?> dw = new DoubleFoo<>(fi,fd);
28 Foo<String> fs = new Foo<>("one");
29 TripleFoo<?,?,?> tw = new TripleFoo<>(fi,fd,fs);
30 }