diamonds: accept captured types; discard anonymous inner classes (IDEA-67125)

This commit is contained in:
anna
2011-04-20 20:10:21 +02:00
parent c0efffec17
commit b94ead9094
18 changed files with 307 additions and 432 deletions
@@ -1,57 +1,37 @@
public class Pos02 {
static class Foo<X> {
Foo(X x) {}
<Z> Foo(X x, Z z) {}
}
static class Foo<X> {
Foo(X x) {}
<Z> Foo(X x, Z z) {}
}
void testSimple() {
Foo<Integer> f1 = new Foo<>(1); //new Foo<Integer> created
Foo<? extends Integer> f2 = new Foo<>(1); //new Foo<Integer> created
Foo<?> f3 = new Foo<>(1); //new Foo<Object> created
Foo<? super Integer> f4 = new Foo<>(1); //new Foo<Object> created
void testSimple() {
Foo<Integer> f1 = new Foo<>(1);
Foo<? extends Integer> f2 = new Foo<>(1);
Foo<?> f3 = new Foo<>(1);
Foo<? super Integer> f4 = new Foo<>(1);
Foo<Integer> f5 = new Foo<>(1){}; //new Foo<Integer> created
Foo<? extends Integer> f6 = new Foo<>(1){}; //new Foo<Integer> created
Foo<?> f7 = new Foo<>(1){}; //new Foo<Object> created
Foo<? super Integer> f8 = new Foo<>(1){}; //new Foo<Object> created
Foo<Integer> f5 = new Foo<>(1, "");
Foo<? extends Integer> f6 = new Foo<>(1, "");
Foo<?> f7 = new Foo<>(1, "");
Foo<? super Integer> f8 = new Foo<>(1, "");
}
Foo<Integer> f9 = new Foo<>(1, ""); //new Foo<Integer> created
Foo<? extends Integer> f10 = new Foo<>(1, ""); //new Foo<Integer> created
Foo<?> f11 = new Foo<>(1, ""); //new Foo<Object> created
Foo<? super Integer> f12 = new Foo<>(1, ""); //new Foo<Object> created
void testQualified() {
Foo<Integer> f1 = new Pos02.Foo<>(1);
Foo<? extends Integer> f2 = new Pos02.Foo<>(1);
Foo<?> f3 = new Pos02.Foo<>(1);
Foo<? super Integer> f4 = new Pos02.Foo<>(1);
Foo<Integer> f13 = new Foo<>(1, ""){}; //new Foo<Integer> created
Foo<? extends Integer> f14 = new Foo<>(1, ""){}; //new Foo<Integer> created
Foo<?> f15 = new Foo<>(1, ""){}; //new Foo<Object> created
Foo<? super Integer> f16 = new Foo<>(1, ""){}; //new Foo<Object> created
}
Foo<Integer> f5 = new Pos02.Foo<>(1, "");
Foo<? extends Integer> f6 = new Pos02.Foo<>(1, "");
Foo<?> f7 = new Pos02.Foo<>(1, "");
Foo<? super Integer> f8 = new Pos02.Foo<>(1, "");
}
void testQualified() {
Foo<Integer> f1 = new Pos02.Foo<>(1); //new Foo<Integer> created
Foo<? extends Integer> f2 = new Pos02.Foo<>(1); //new Foo<Integer> created
Foo<?> f3 = new Pos02.Foo<>(1); //new Foo<Object> created
Foo<? super Integer> f4 = new Pos02.Foo< >(1); //new Foo<Object> created
Foo<Integer> f5 = new Pos02.Foo<>(1){}; //new Foo<Integer> created
Foo<? extends Integer> f6 = new Pos02.Foo<>(1){}; //new Foo<Integer> created
Foo<?> f7 = new Pos02.Foo<>(1){}; //new Foo<Object> created
Foo<? super Integer> f8 = new Pos02.Foo<>(1){}; //new Foo<Object> created
Foo<Integer> f9 = new Pos02.Foo<>(1, ""); //new Foo<Integer> created
Foo<? extends Integer> f10 = new Pos02.Foo<>(1, ""); //new Foo<Integer> created
Foo<?> f11 = new Pos02.Foo<>(1, ""); //new Foo<Object> created
Foo<? super Integer> f12 = new Pos02.Foo<>(1, ""); //new Foo<Object> created
Foo<Integer> f13 = new Pos02.Foo<>(1, ""){}; //new Foo<Integer> created
Foo<? extends Integer> f14 = new Pos02.Foo<>(1, ""){}; //new Foo<Integer> created
Foo<?> f15 = new Pos02.Foo<>(1, ""){}; //new Foo<Object> created
Foo<? super Integer> f16 = new Pos02.Foo<>(1, ""){}; //new Foo<Object> created
}
public static void main(String[] args) {
Pos02 p2 = new Pos02();
p2.testSimple();
p2.testQualified();
}
}
public static void main(String[] args) {
Pos02 p2 = new Pos02();
p2.testSimple();
p2.testQualified();
}
}