|
1 /* |
|
2 * @test /nodynamiccopyright/ |
|
3 * @bug 6939780 7020044 8009459 |
|
4 * |
|
5 * @summary add a warning to detect diamond sites |
|
6 * @author mcimadamore |
|
7 * @compile/ref=T6939780_7.out -Xlint:-options -source 7 T6939780.java -XDrawDiagnostics -XDfindDiamond |
|
8 * @compile/ref=T6939780_8.out T6939780.java -XDrawDiagnostics -XDfindDiamond |
|
9 * |
|
10 */ |
|
11 |
|
12 class T6939780 { |
|
13 |
|
14 static class Foo<X extends Number> { |
|
15 Foo() {} |
|
16 Foo(X x) {} |
|
17 } |
|
18 |
|
19 void testAssign() { |
|
20 Foo<Number> f1 = new Foo<Number>(1); |
|
21 Foo<?> f2 = new Foo<Number>(); |
|
22 Foo<?> f3 = new Foo<Integer>(); |
|
23 Foo<Number> f4 = new Foo<Number>(1) {}; |
|
24 Foo<?> f5 = new Foo<Number>() {}; |
|
25 Foo<?> f6 = new Foo<Integer>() {}; |
|
26 } |
|
27 |
|
28 void testMethod() { |
|
29 gn(new Foo<Number>(1)); |
|
30 gw(new Foo<Number>()); |
|
31 gw(new Foo<Integer>()); |
|
32 gn(new Foo<Number>(1) {}); |
|
33 gw(new Foo<Number>() {}); |
|
34 gw(new Foo<Integer>() {}); |
|
35 } |
|
36 |
|
37 void gw(Foo<?> fw) { } |
|
38 void gn(Foo<Number> fn) { } |
|
39 } |