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