Mon, 26 Mar 2012 15:28:22 +0100
7151492: Encapsulate check logic into Attr.ResultInfo
Summary: ResultInfo class should be used to make attribution code transparent w.r.t. check logic being used
Reviewed-by: jjg, dlsmith
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 6939620 7020044
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 */
12 class Neg01<X extends Number> {
14 Neg01(X x) {}
16 <Z> Neg01(X x, Z z) {}
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<>("");
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 }