equal
deleted
inserted
replaced
|
1 /* |
|
2 * @test /nodynamiccopyright/ |
|
3 * @bug 6939620 7020044 8062373 |
|
4 * |
|
5 * @summary Check that diamond fails when inference violates declared bounds |
|
6 * (test with local class, qualified/simple type expressions) |
|
7 * @author mcimadamore |
|
8 * @compile/fail/ref=Neg04.out Neg04.java -XDrawDiagnostics |
|
9 * |
|
10 */ |
|
11 |
|
12 class Neg04 { |
|
13 |
|
14 void test() { |
|
15 class Foo<V extends Number> { |
|
16 Foo(V x) {} |
|
17 <Z> Foo(V x, Z z) {} |
|
18 } |
|
19 Foo<String> n1 = new Foo<>(""); |
|
20 Foo<? extends String> n2 = new Foo<>(""); |
|
21 Foo<?> n3 = new Foo<>(""); |
|
22 Foo<? super String> n4 = new Foo<>(""); |
|
23 |
|
24 Foo<String> n5 = new Foo<>("", ""); |
|
25 Foo<? extends String> n6 = new Foo<>("", ""); |
|
26 Foo<?> n7 = new Foo<>("", ""); |
|
27 Foo<? super String> n8 = new Foo<>("", ""); |
|
28 |
|
29 Foo<String> n9 = new Foo<>(""){}; |
|
30 Foo<? extends String> n10 = new Foo<>(""){}; |
|
31 Foo<?> n11 = new Foo<>(""){}; |
|
32 Foo<? super String> n12 = new Foo<>(""){}; |
|
33 |
|
34 Foo<String> n13 = new Foo<>("", ""){}; |
|
35 Foo<? extends String> n14 = new Foo<>("", ""){}; |
|
36 Foo<?> n15 = new Foo<>("", ""){}; |
|
37 Foo<? super String> n16 = new Foo<>("", ""){}; |
|
38 } |
|
39 } |