mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-17 07:20:53 +07:00
diamonds: 1.7 type inference for New Expressions
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
class Neg01<X extends Number> {
|
||||
|
||||
Neg01(X x) {
|
||||
}
|
||||
|
||||
<Z> Neg01(X x, Z z) {
|
||||
}
|
||||
|
||||
void test() {
|
||||
Neg01<<error>String</error>> n1 = new Neg01<<error></error>>("" ); //new Foo<Integer> created
|
||||
Neg01<? extends String> n2 = new Neg01<<error></error>>(""); //new Foo<Integer> created
|
||||
Neg01<?> n3 = new Neg01<><error>("")</error>; //new Foo<Object> created
|
||||
Neg01<? super String> n4 = new Neg01<<error></error>>(""); //new Foo<Object> created
|
||||
|
||||
Neg01<<error>String</error>> n5 = new Neg01<<error></error>>("") {
|
||||
}; //new Foo<Integer> created
|
||||
Neg01<? extends String> n6 = new Neg01<<error></error>>("") {
|
||||
}; //new Foo<Integer> created
|
||||
Neg01<?> n7 = new Neg01<><error>("")</error> {
|
||||
}; //new Foo<Object> created
|
||||
Neg01<? super String> n8 = new Neg01<<error></error>>("") {
|
||||
}; //new Foo<Object> created
|
||||
|
||||
Neg01<<error>String</error>> n9 = new Neg01<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Neg01<? extends String> n10 = new Neg01<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Neg01<?> n11 = new Neg01<><error>("", "")</error>; //new Foo<Object> created
|
||||
<error>Foo</error><? super String> n12 = new Neg01<<error></error>>("", ""); //new Foo<Object> created
|
||||
|
||||
Neg01<<error>String</error>> n13 = new Neg01<<error></error>>("", "") {
|
||||
}; //new Foo<Integer> created
|
||||
Neg01<? extends String> n14 = new Neg01<<error></error>>("", "") {
|
||||
}; //new Foo<Integer> created
|
||||
Neg01<?> n15 = new Neg01<><error>("", "")</error> {
|
||||
}; //new Foo<Object> created
|
||||
Neg01<? super String> n16 = new Neg01<<error></error>>("", "") {
|
||||
}; //new Foo<Object> created
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
class Neg02 {
|
||||
|
||||
static class Foo<X extends Number> {
|
||||
Foo(X x) {
|
||||
}
|
||||
|
||||
<Z> Foo(X x, Z z) {
|
||||
}
|
||||
}
|
||||
|
||||
void testSimple() {
|
||||
Foo<<error>String</error>> f1 = new Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
Foo<? extends String> f2 = new Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
Foo<?> f3 = new Foo<><error>("")</error>; //new Foo<Object> created
|
||||
Foo<? super String> f4 = new Foo<<error></error>>(""); //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> f5 = new Foo<<error></error>>("") {
|
||||
}; //new Foo<Integer> created
|
||||
Foo<? extends String> f6 = new Foo<<error></error>>("") {
|
||||
}; //new Foo<Integer> created
|
||||
Foo<?> f7 = new Foo< ><error>("")</error> {
|
||||
}; //new Foo<Object> created
|
||||
Foo<? super String> f8 = new Foo<<error></error>>("") {
|
||||
}; //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> f9 = new Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Foo<? extends String> f10 = new Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Foo<?> f11 = new Foo< ><error>("", "")</error>; //new Foo<Object> created
|
||||
Foo<? super String> f12 = new Foo<<error></error>>("", ""); //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> f13 = new Foo<<error></error>>("", "") {
|
||||
}; //new Foo<Integer> created
|
||||
Foo<? extends String> f14 = new Foo<<error></error>>("", "") {
|
||||
}; //new Foo<Integer> created
|
||||
Foo<?> f15 = new Foo< ><error>("", "")</error> {
|
||||
}; //new Foo<Object> created
|
||||
Foo<? super String> f16 = new Foo<<error></error>>("", "") {
|
||||
}; //new Foo<Object> created
|
||||
}
|
||||
|
||||
void testQualified() {
|
||||
Foo<<error>String</error>> f1 = new Neg02.Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
Foo<? extends String> f2 = new Neg02.Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
Foo<?> f3 = new Neg02.Foo< ><error>("")</error>; //new Foo<Object> created
|
||||
Foo<? super String> f4 = new Neg02.Foo<<error></error>>(""); //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> f5 = new Neg02.Foo<<error></error>>("") {
|
||||
}; //new Foo<Integer> created
|
||||
Foo<? extends String> f6 = new Neg02.Foo<<error></error>>("") {
|
||||
}; //new Foo<Integer> created
|
||||
Foo<?> f7 = new Neg02.Foo< ><error>("")</error> {
|
||||
}; //new Foo<Object> created
|
||||
Foo<? super String> f8 = new Neg02.Foo<<error></error>>("") {
|
||||
}; //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> f9 = new Neg02.Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Foo<? extends String> f10 = new Neg02.Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Foo<?> f11 = new Neg02.Foo< ><error>("", "")</error>; //new Foo<Object> created
|
||||
Foo<? super String> f12 = new Neg02.Foo<<error></error>>("", ""); //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> f13 = new Neg02.Foo<<error></error>>("", "") {
|
||||
}; //new Foo<Integer> created
|
||||
Foo<? extends String> f14 = new Neg02.Foo<<error></error>>("", "") {
|
||||
}; //new Foo<Integer> created
|
||||
Foo<?> f15 = new Neg02.Foo< ><error>("", "")</error> {
|
||||
}; //new Foo<Object> created
|
||||
Foo<? super String> f16 = new Neg02.Foo<<error></error>>("", "") {
|
||||
}; //new Foo<Object> created
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
class Neg03<U> {
|
||||
|
||||
class Foo<V extends Number> {
|
||||
Foo(V x) {}
|
||||
<Z> Foo(V x, Z z) {}
|
||||
}
|
||||
|
||||
void testSimple() {
|
||||
Foo<<error>String</error>> f1 = new Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
Foo<? extends String> f2 = new Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
Foo<?> f3 = new Foo<><error>("")</error>; //new Foo<Object> created
|
||||
Foo<? super String> f4 = new Foo<<error></error>>(""); //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> f5 = new Foo<<error></error>>(""){}; //new Foo<Integer> created
|
||||
Foo<? extends String> f6 = new Foo<<error></error>>(""){}; //new Foo<Integer> created
|
||||
Foo<?> f7 = new Foo<><error>("")</error>{}; //new Foo<Object> created
|
||||
Foo<? super String> f8 = new Foo<<error></error>>(""){}; //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> f9 = new Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Foo<? extends String> f10 = new Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Foo<?> f11 = new Foo<><error>("", "")</error>; //new Foo<Object> created
|
||||
Foo<? super String> f12 = new Foo<<error></error>>("", ""); //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> f13 = new Foo<<error></error>>("", ""){}; //new Foo<Integer> created
|
||||
Foo<? extends String> f14 = new Foo<<error></error>>("", ""){}; //new Foo<Integer> created
|
||||
Foo<?> f15 = new Foo<><error>("", "")</error>{}; //new Foo<Object> created
|
||||
Foo<? super String> f16 = new Foo<<error></error>>("", ""){}; //new Foo<Object> created
|
||||
}
|
||||
|
||||
void testQualified_1() {
|
||||
Foo<<error>String</error>> f1 = new Neg03<U>.Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
Foo<? extends String> f2 = new Neg03<U>.Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
Foo<?> f3 = new Neg03<U>.Foo<><error>("")</error>; //new Foo<Object> created
|
||||
Foo<? super String> f4 = new Neg03<U>.Foo<<error></error>>(""); //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> f5 = new Neg03<U>.Foo<<error></error>>(""){}; //new Foo<Integer> created
|
||||
Foo<? extends String> f6 = new Neg03<U>.Foo<<error></error>>(""){}; //new Foo<Integer> created
|
||||
Foo<?> f7 = new Neg03<U>.Foo<><error>("")</error>{}; //new Foo<Object> created
|
||||
Foo<? super String> f8 = new Neg03<U>.Foo<<error></error>>(""){}; //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> f9 = new Neg03<U>.Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Foo<? extends String> f10 = new Neg03<U>.Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Foo<?> f11 = new Neg03<U>.Foo<><error>("", "")</error>; //new Foo<Object> created
|
||||
Foo<? super String> f12 = new Neg03<U>.Foo<<error></error>>("", ""); //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> f13 = new Neg03<U>.Foo<<error></error>>("", ""){}; //new Foo<Integer> created
|
||||
Foo<? extends String> f14 = new Neg03<U>.Foo<<error></error>>("", ""){}; //new Foo<Integer> created
|
||||
Foo<?> f15 = new Neg03<U>.Foo<><error>("", "")</error>{}; //new Foo<Object> created
|
||||
Foo<? super String> f16 = new Neg03<U>.Foo<<error></error>>("", ""){}; //new Foo<Object> created
|
||||
}
|
||||
|
||||
void testQualified_2(Neg03<U> n) {
|
||||
Foo<<error>String</error>> f1 = n.new Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
Foo<? extends String> f2 = n.new Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
Foo<?> f3 = n.new Foo<><error>("")</error>; //new Foo<Integer> created
|
||||
Foo<? super String> f4 = n.new Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
|
||||
Foo<<error>String</error>> f5 = n.new Foo<<error></error>>(""){}; //new Foo<Integer> created
|
||||
Foo<? extends String> f6 = n.new Foo<<error></error>>(""){}; //new Foo<Integer> created
|
||||
Foo<?> f7 = n.new Foo<><error>("")</error>{}; //new Foo<Integer> created
|
||||
Foo<? super String> f8 = n.new Foo<<error></error>>(""){}; //new Foo<Integer> created
|
||||
|
||||
Foo<<error>String</error>> f9 = n.new Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Foo<? extends String> f10 = n.new Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Foo<?> f11 = n.new Foo<><error>("", "")</error>; //new Foo<Integer> created
|
||||
Foo<? super String> f12 = n.new Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
|
||||
Foo<<error>String</error>> f13 = n.new Foo<<error></error>>("", ""){}; //new Foo<Integer> created
|
||||
Foo<? extends String> f14 = n.new Foo<<error></error>>("", ""){}; //new Foo<Integer> created
|
||||
Foo<?> f15 = n.new Foo<><error>("", "")</error>{}; //new Foo<Integer> created
|
||||
Foo<? super String> f16 = n.new Foo<<error></error>>("", ""){}; //new Foo<Integer> created
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
class Neg04 {
|
||||
|
||||
void test() {
|
||||
class Foo<V extends Number> {
|
||||
Foo(V x) {}
|
||||
<Z> Foo(V x, Z z) {}
|
||||
}
|
||||
Foo<<error>String</error>> n1 = new Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
Foo<? extends String> n2 = new Foo<<error></error>>(""); //new Foo<Integer> created
|
||||
Foo<?> n3 = new Foo<><error>("")</error>; //new Foo<Object> created
|
||||
Foo<? super String> n4 = new Foo<<error></error>>(""); //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> n5 = new Foo<<error></error>>(""){}; //new Foo<Integer> created
|
||||
Foo<? extends String> n6 = new Foo<<error></error>>(""){}; //new Foo<Integer> created
|
||||
Foo<?> n7 = new Foo<><error>("")</error>{}; //new Foo<Object> created
|
||||
Foo<? super String> n8 = new Foo<<error></error>>(""){}; //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> n9 = new Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Foo<? extends String> n10 = new Foo<<error></error>>("", ""); //new Foo<Integer> created
|
||||
Foo<?> n11 = new Foo<><error>("", "")</error>; //new Foo<Object> created
|
||||
Foo<? super String> n12 = new Foo<<error></error>>("", ""); //new Foo<Object> created
|
||||
|
||||
Foo<<error>String</error>> n13 = new Foo<<error></error>>("", ""){}; //new Foo<Integer> created
|
||||
Foo<? extends String> n14 = new Foo<<error></error>>("", ""){}; //new Foo<Integer> created
|
||||
Foo<?> n15 = new Foo<><error>("", "")</error>{}; //new Foo<Object> created
|
||||
Foo<? super String> n16 = new Foo<<error></error>>("", ""){}; //new Foo<Object> created
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
class Neg05<U> {
|
||||
|
||||
class Foo<V> {
|
||||
Foo(V x) {}
|
||||
<Z> Foo(V x, Z z) {}
|
||||
}
|
||||
|
||||
void testRare_1() {
|
||||
Neg05<?>.Foo<String> f1 = new Neg05.Foo<error><></error>(""); //new Foo<Integer> created
|
||||
Neg05<?>.Foo<? extends String> f2 = new Neg05.Foo<error><></error>(""); //new Foo<Integer> created
|
||||
Neg05<?>.Foo<?> f3 = new Neg05.Foo<error><></error>(""); //new Foo<Object> created
|
||||
Neg05<?>.Foo<? super String> f4 = new Neg05.Foo<error><></error>(""); //new Foo<Object> created
|
||||
|
||||
Neg05<?>.Foo<String> f5 = new Neg05.Foo<error><></error>(""){}; //new Foo<Integer> created
|
||||
Neg05<?>.Foo<? extends String> f6 = new Neg05.Foo<error><></error>(""){}; //new Foo<Integer> created
|
||||
Neg05<?>.Foo<?> f7 = new Neg05.Foo<error><></error>(""){}; //new Foo<Object> created
|
||||
Neg05<?>.Foo<? super String> f8 = new Neg05.Foo<error><></error>(""){}; //new Foo<Object> created
|
||||
|
||||
Neg05<?>.Foo<String> f9 = new Neg05.Foo<error><></error>("", ""); //new Foo<Integer> created
|
||||
Neg05<?>.Foo<? extends String> f10 = new Neg05.Foo<error><></error>("", ""); //new Foo<Integer> created
|
||||
Neg05<?>.Foo<?> f11 = new Neg05.Foo<error><></error>("", ""); //new Foo<Object> created
|
||||
Neg05<?>.Foo<? super String> f12 = new Neg05.Foo<error><></error>("", ""); //new Foo<Object> created
|
||||
|
||||
Neg05<?>.Foo<String> f13 = new Neg05.Foo<error><></error>("", ""){}; //new Foo<Integer> created
|
||||
Neg05<?>.Foo<? extends String> f14 = new Neg05.Foo<error><></error>("", ""){}; //new Foo<Integer> created
|
||||
Neg05<?>.Foo<?> f15 = new Neg05.Foo<error><></error>("", ""){}; //new Foo<Object> created
|
||||
Neg05<?>.Foo<? super String> f16 = new Neg05.Foo<error><></error>("", ""){}; //new Foo<Object> created
|
||||
}
|
||||
|
||||
void testRare_2(Neg05 n) {
|
||||
Neg05<?>.Foo<String> f1 = n.new Foo<error><></error>(""); //new Foo<Integer> created
|
||||
Neg05<?>.Foo<? extends String> f2 = n.new Foo<error><></error>(""); //new Foo<Integer> created
|
||||
Neg05<?>.Foo<?> f3 = n.new Foo<error><></error>(""); //new Foo<Integer> created
|
||||
Neg05<?>.Foo<? super String> f4 = n.new Foo<error><></error>(""); //new Foo<Integer> created
|
||||
|
||||
Neg05<?>.Foo<String> f5 = n.new Foo<error><></error>(""){}; //new Foo<Integer> created
|
||||
Neg05<?>.Foo<? extends String> f6 = n.new Foo<error><></error>(""){}; //new Foo<Integer> created
|
||||
Neg05<?>.Foo<?> f7 = n.new Foo<error><></error>(""){}; //new Foo<Integer> created
|
||||
Neg05<?>.Foo<? super String> f8 = n.new Foo<error><></error>(""){}; //new Foo<Integer> created
|
||||
|
||||
Neg05<?>.Foo<String> f9 = n.new Foo<error><></error>("", ""); //new Foo<Integer> created
|
||||
Neg05<?>.Foo<? extends String> f10 = n.new Foo<error><></error>("", ""); //new Foo<Integer> created
|
||||
Neg05<?>.Foo<?> f11 = n.new Foo<error><></error>("", ""); //new Foo<Integer> created
|
||||
Neg05<?>.Foo<? super String> f12 = n.new Foo<error><></error>("", ""); //new Foo<Integer> created
|
||||
|
||||
Neg05<?>.Foo<String> f13 = n.new Foo<error><></error>("", ""){}; //new Foo<Integer> created
|
||||
Neg05<?>.Foo<? extends String> f14 = n.new Foo<error><></error>("", ""){}; //new Foo<Integer> created
|
||||
Neg05<?>.Foo<?> f15 = n.new Foo<error><></error>("", ""){}; //new Foo<Integer> created
|
||||
Neg05<?>.Foo<? super String> f16 = n.new Foo<error><></error>("", ""){}; //new Foo<Integer> created
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
public class Pos01<X> {
|
||||
|
||||
Pos01(X x) {}
|
||||
|
||||
<Z> Pos01(X x, Z z) {}
|
||||
|
||||
void test() {
|
||||
Pos01<Integer> p1 = new Pos01<>(1); //new Foo<Integer> created
|
||||
Pos01<? extends Integer> p2 = new Pos01<>(1); //new Foo<Integer> created
|
||||
Pos01<?> p3 = new Pos01<>(1); //new Foo<Object> created
|
||||
Pos01<? super Integer> p4 = new Pos01<>(1); //new Foo<Object> created
|
||||
|
||||
Pos01<Integer> p5 = new Pos01<>(1){}; //new Foo<Integer> created
|
||||
Pos01<? extends Integer> p6 = new Pos01<>(1){}; //new Foo<Integer> created
|
||||
Pos01<?> p7 = new Pos01<>(1){}; //new Foo<Object> created
|
||||
Pos01<? super Integer> p8 = new Pos01<>(1){}; //new Foo<Object> created
|
||||
|
||||
Pos01<Integer> p9 = new Pos01<>(1, ""); //new Foo<Integer> created
|
||||
Pos01<? extends Integer> p10 = new Pos01<>(1, ""); //new Foo<Integer> created
|
||||
Pos01<?> p11 = new Pos01<>(1, ""); //new Foo<Object> created
|
||||
Pos01<? super Integer> p12 = new Pos01<>(1, ""); //new Foo<Object> created
|
||||
|
||||
Pos01<Integer> p13 = new Pos01<>(1, ""){}; //new Foo<Integer> created
|
||||
Pos01<? extends Integer> p14= new Pos01<>(1, ""){}; //new Foo<Integer> created
|
||||
Pos01<?> p15 = new Pos01<>(1, ""){}; //new Foo<Object> created
|
||||
Pos01<? super Integer> p16 = new Pos01<>(1, ""){}; //new Foo<Object> created
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Pos01<String> p1 = new Pos01<>("");
|
||||
p1.test();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
public class Pos02 {
|
||||
|
||||
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
|
||||
|
||||
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> 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
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
public class Pos03<U> {
|
||||
|
||||
class Foo<V> {
|
||||
Foo(V x) {}
|
||||
<Z> Foo(V 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
|
||||
|
||||
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> 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
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
void testQualified_1() {
|
||||
Foo<Integer> f1 = new Pos03<U>.Foo<>(1); //new Foo<Integer> created
|
||||
Foo<? extends Integer> f2 = new Pos03<U>.Foo<>(1); //new Foo<Integer> created
|
||||
Foo<?> f3 = new Pos03<U>.Foo<>(1); //new Foo<Object> created
|
||||
Foo<? super Integer> f4 = new Pos03<U>.Foo<>(1); //new Foo<Object> created
|
||||
|
||||
Foo<Integer> f5 = new Pos03<U>.Foo<>(1){}; //new Foo<Integer> created
|
||||
Foo<? extends Integer> f6 = new Pos03<U>.Foo<>(1){}; //new Foo<Integer> created
|
||||
Foo<?> f7 = new Pos03<U>.Foo<>(1){}; //new Foo<Object> created
|
||||
Foo<? super Integer> f8 = new Pos03<U>.Foo<>(1){}; //new Foo<Object> created
|
||||
|
||||
Foo<Integer> f9 = new Pos03<U>.Foo<>(1, ""); //new Foo<Integer> created
|
||||
Foo<? extends Integer> f10 = new Pos03<U>.Foo<>(1, ""); //new Foo<Integer> created
|
||||
Foo<?> f11 = new Pos03<U>.Foo<>(1, ""); //new Foo<Object> created
|
||||
Foo<? super Integer> f12 = new Pos03<U>.Foo<>(1, ""); //new Foo<Object> created
|
||||
|
||||
Foo<Integer> f13 = new Pos03<U>.Foo<>(1, ""){}; //new Foo<Integer> created
|
||||
Foo<? extends Integer> f14 = new Pos03<U>.Foo<>(1, ""){}; //new Foo<Integer> created
|
||||
Foo<?> f15 = new Pos03<U>.Foo<>(1, " "){}; //new Foo<Object> created
|
||||
Foo<? super Integer> f16 = new Pos03<U>.Foo<>(1, ""){}; //new Foo<Object> created
|
||||
}
|
||||
|
||||
void testQualified_2(Pos03<U> p) {
|
||||
Foo<Integer> f1 = p.new Foo<>(1); //new Foo<Integer> created
|
||||
Foo<? extends Integer> f2 = p.new Foo<>( 1); //new Foo<Integer> created
|
||||
Foo<?> f3 = p.new Foo<>(1); //new Foo<Object> created
|
||||
Foo<? super Integer> f4 = p.new Foo<>(1); //new Foo<Object> created
|
||||
|
||||
Foo<Integer> f5 = p.new Foo<>(1){}; //new Foo<Integer> created
|
||||
Foo<? extends Integer> f6 = p.new Foo<>(1){}; //new Foo<Integer> created
|
||||
Foo<?> f7 = p.new Foo<>(1){}; //new Foo<Object> created
|
||||
Foo<? super Integer> f8 = p.new Foo<>(1){}; //new Foo<Object> created
|
||||
|
||||
Foo<Integer> f9 = p.new Foo<>(1, ""); //new Foo<Integer> created
|
||||
Foo<? extends Integer> f10 = p.new Foo<>(1, ""); //new Foo<Integer> created
|
||||
Foo<?> f11 = p.new Foo<>(1, ""); //new Foo<Object> created
|
||||
Foo<? super Integer> f12 = p.new Foo<>(1, ""); //new Foo<Object> created
|
||||
|
||||
Foo<Integer> f13 = p.new Foo<>(1, ""){}; //new Foo<Integer> created
|
||||
Foo<? extends Integer> f14 = p.new Foo<>(1, ""){}; //new Foo<Integer> created
|
||||
Foo<?> f15 = p.new Foo<>(1, ""){}; //new Foo<Object> created
|
||||
Foo<? super Integer> f16 = p.new Foo<>(1, ""){}; //new Foo<Object> created
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Pos03<String> p3 = new Pos03<>( );
|
||||
p3.testSimple();
|
||||
p3.testQualified_1();
|
||||
p3.testQualified_2(p3);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
public class Pos04<U> {
|
||||
|
||||
void test() {
|
||||
class Foo<V> {
|
||||
Foo(V x) {
|
||||
}
|
||||
|
||||
<Z> Foo(V x, Z z) {
|
||||
}
|
||||
}
|
||||
Foo<Integer> p1 = new Foo< >(1); //new Foo<Integer> created
|
||||
Foo<? extends Integer> p2 = new Foo< >(1); //new Foo<Integer> created
|
||||
Foo<?> p3 = new Foo< >(1); //new Foo<Object> created
|
||||
Foo<? super Integer> p4 = new Foo< >(1); //new Foo<Object> created
|
||||
|
||||
Foo<Integer> p5 = new Foo< >(1) {
|
||||
}; //new Foo<Integer> created
|
||||
Foo<? extends Integer> p6 = new Foo< >(1) {
|
||||
}; //new Foo<Integer> created
|
||||
Foo<?> p7 = new Foo< >(1) {
|
||||
}; //new Foo<Object> created
|
||||
Foo<? super Integer> p8 = new Foo< >(1) {
|
||||
}; //new Foo<Object> created
|
||||
|
||||
Foo<Integer> p9 = new Foo< >(1, ""); //new Foo<Integer> created
|
||||
Foo<? extends Integer> p10 = new Foo< >(1, ""); //new Foo<Integer> created
|
||||
Foo<?> p11 = new Foo< >(1, ""); //new Foo<Object> created
|
||||
Foo<? super Integer> p12 = new Foo< >(1, ""); //new Foo<Object> created
|
||||
|
||||
Foo<Integer> p13 = new Foo< >(1, "") {
|
||||
}; //new Foo<Integer> created
|
||||
Foo<? extends Integer> p14 = new Foo< >(1, "") {
|
||||
}; //new Foo<Integer> created
|
||||
Foo<?> p15 = new Foo< >(1, "") {
|
||||
}; //new Foo<Object> created
|
||||
Foo<? super Integer> p16 = new Foo< >(1, "") {
|
||||
}; //new Foo<Object> created
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Pos04<String> p4 = new Pos04<>();
|
||||
p4.test();
|
||||
}
|
||||
}
|
||||
@@ -16,4 +16,40 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testSwitchByString() throws Exception {
|
||||
doTest(true, false);
|
||||
}
|
||||
|
||||
public void testDiamondPos1() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testDiamondPos2() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testDiamondPos3() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testDiamondPos4() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testDiamondNeg1() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testDiamondNeg2() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testDiamondNeg3() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testDiamondNeg4() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testDiamondNeg5() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user