equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * @test /nodynamiccopyright/ |
2 * @test /nodynamiccopyright/ |
3 * @bug 6939620 6894753 |
3 * @bug 7020043 7020044 |
4 * |
4 * |
5 * @summary Switch to 'complex' diamond inference scheme |
5 * @summary Check that diamond is not allowed with non-generic class types |
6 * @author mcimadamore |
6 * @author Rémi Forax |
7 * @compile/fail/ref=Neg08.out Neg08.java -XDrawDiagnostics |
7 * @compile/fail/ref=Neg08.out Neg08.java -XDrawDiagnostics |
8 * |
8 * |
9 */ |
9 */ |
10 |
10 |
11 class Neg08 { |
11 class Neg08 { |
12 static class Foo<X> { |
12 public static void main(String[] args) { |
13 Foo(X x) { } |
13 String s = new String<>("foo"); |
14 } |
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); |
|
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 } |
15 } |