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
4 *
5 * @summary Switch to 'complex' diamond inference scheme
6 * @author mcimadamore
7 * @compile/fail/ref=Neg04.out Neg04.java -XDrawDiagnostics
8 *
9 */
11 class Neg04 {
13 void test() {
14 class Foo<V extends Number> {
15 Foo(V x) {}
16 <Z> Foo(V x, Z z) {}
17 }
18 Foo<String> n1 = new Foo<>("");
19 Foo<? extends String> n2 = new Foo<>("");
20 Foo<?> n3 = new Foo<>("");
21 Foo<? super String> n4 = new Foo<>("");
23 Foo<String> n5 = new Foo<>(""){};
24 Foo<? extends String> n6 = new Foo<>(""){};
25 Foo<?> n7 = new Foo<>(""){};
26 Foo<? super String> n8 = new Foo<>(""){};
28 Foo<String> n9 = new Foo<>("", "");
29 Foo<? extends String> n10 = new Foo<>("", "");
30 Foo<?> n11 = new Foo<>("", "");
31 Foo<? super String> n12 = new Foo<>("", "");
33 Foo<String> n13 = new Foo<>("", ""){};
34 Foo<? extends String> n14 = new Foo<>("", ""){};
35 Foo<?> n15 = new Foo<>("", ""){};
36 Foo<? super String> n16 = new Foo<>("", ""){};
37 }
38 }