|
1 /* |
|
2 * @test /nodynamiccopyright/ |
|
3 * @bug 6939620 7020044 |
|
4 * |
|
5 * @summary Check that usage of rare types doesn't cause spurious diamond diagnostics |
|
6 * @author mcimadamore |
|
7 * @compile/fail/ref=Neg05.out Neg05.java -XDrawDiagnostics |
|
8 * |
|
9 */ |
|
10 |
|
11 class Neg05<U> { |
|
12 |
|
13 class Foo<V> { |
|
14 Foo(V x) {} |
|
15 <Z> Foo(V x, Z z) {} |
|
16 } |
|
17 |
|
18 void testRare_1() { |
|
19 Neg05<?>.Foo<String> f1 = new Neg05.Foo<>(""); |
|
20 Neg05<?>.Foo<? extends String> f2 = new Neg05.Foo<>(""); |
|
21 Neg05<?>.Foo<?> f3 = new Neg05.Foo<>(""); |
|
22 Neg05<?>.Foo<? super String> f4 = new Neg05.Foo<>(""); |
|
23 |
|
24 Neg05<?>.Foo<String> f5 = new Neg05.Foo<>("", ""); |
|
25 Neg05<?>.Foo<? extends String> f6 = new Neg05.Foo<>("", ""); |
|
26 Neg05<?>.Foo<?> f7 = new Neg05.Foo<>("", ""); |
|
27 Neg05<?>.Foo<? super String> f8 = new Neg05.Foo<>("", ""); |
|
28 } |
|
29 |
|
30 void testRare_2(Neg05 n) { |
|
31 Neg05<?>.Foo<String> f1 = n.new Foo<>(""); |
|
32 Neg05<?>.Foo<? extends String> f2 = n.new Foo<>(""); |
|
33 Neg05<?>.Foo<?> f3 = n.new Foo<>(""); |
|
34 Neg05<?>.Foo<? super String> f4 = n.new Foo<>(""); |
|
35 |
|
36 Neg05<?>.Foo<String> f5 = n.new Foo<>("", ""); |
|
37 Neg05<?>.Foo<? extends String> f6 = n.new Foo<>("", ""); |
|
38 Neg05<?>.Foo<?> f7 = n.new Foo<>("", ""); |
|
39 Neg05<?>.Foo<? super String> f8 = n.new Foo<>("", ""); |
|
40 } |
|
41 } |