diamonds: cannot use diamonds with explicit constructor types/disable checks on type args for non generics constructors (sic!?)

This commit is contained in:
anna
2011-05-17 20:31:59 +04:00
parent 1ccbc4e984
commit 097a350597
11 changed files with 39 additions and 49 deletions

View File

@@ -4,7 +4,7 @@ class Neg12 {
<T> Foo(T t) {}
}
Foo<Integer> fi1 = new <<error descr="Actual type argument and inferred type contradict each other">String</error>> Foo<>(1);
Foo<Integer> fi1 = new <String> Foo<<error descr="Cannot use diamonds with explicit type parameters for constructor"></error>>(1);
Foo<Integer> fi2 = new <<error descr="Actual type argument and inferred type contradict each other">String</error>> Foo<Integer>(1);
Foo<Integer> fi3 = new Foo<Integer>(1);
}

View File

@@ -4,6 +4,6 @@ class Neg13 {
<T> Foo(T t) {}
}
Foo<Integer> fi1 = new <error descr="Wrong number of type arguments: 2; required: 1"><String, Integer></error> Foo<>("");
Foo<Integer> fi1 = new <String, Integer> Foo<<error descr="Cannot use diamonds with explicit type parameters for constructor"></error>>("");
Foo<Integer> fi2 = new <error descr="Wrong number of type arguments: 2; required: 1"><String, Integer></error> Foo<Integer>("");
}

View File

@@ -4,6 +4,6 @@ class Neg14 {
<T extends Integer> Foo(T t) {}
}
Foo<Integer> fi1 = new <<error descr="Actual type argument and inferred type contradict each other">String</error>> Foo<>(1);
Foo<Integer> fi1 = new <String> Foo<<error descr="Cannot use diamonds with explicit type parameters for constructor"></error>>(1);
Foo<Integer> fi2 = new <<error descr="Actual type argument and inferred type contradict each other">String</error>> Foo<Integer>(1);
}

View File

@@ -0,0 +1,13 @@
class Pos8 {
static class Foo<X> {
Foo(X t) {}
}
Foo<Integer> fi1 = new Foo<>(1);
Foo<Integer> fi2 = new Foo<Integer>(1);
Foo<Integer> fi3 = new <String> Foo<<error descr="Cannot use diamonds with explicit type parameters for constructor"></error>>(1);
Foo<Integer> fi4 = new <String> Foo<Integer>(1);
Foo<Integer> fi5 = new <String, String> Foo<<error descr="Cannot use diamonds with explicit type parameters for constructor"></error>>(1);
Foo<Integer> fi6 = new <String, String> Foo<Integer>(1);
}

View File

@@ -1,4 +1,4 @@
public class Pos04<U> {
public class Pos4<U> {
void test() {
class Foo<V> {
@@ -17,7 +17,7 @@ public class Pos04<U> {
}
public static void main(String[] args) {
Pos04<String> p4 = new Pos04<>();
Pos4<String> p4 = new Pos4<>();
p4.test();
}
}

View File

@@ -1,18 +1,3 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class Pos06 {
static class Foo<X> {
Foo(X x) { }

View File

@@ -1,18 +1,3 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class Pos07 {
static class Foo<X extends Number & Comparable<Number>> {}
static class DoubleFoo<X extends Number & Comparable<Number>,

View File

@@ -1,13 +0,0 @@
class Pos8 {
static class Foo<X> {
Foo(X t) {}
}
Foo<Integer> fi1 = new Foo<>(1);
Foo<Integer> fi2 = new Foo<Integer>(1);
Foo<Integer> fi3 = new <String> Foo<>(1);
Foo<Integer> fi4 = new <String> Foo<Integer>(1);
Foo<Integer> fi5 = new <String, String> Foo<>(1);
Foo<Integer> fi6 = new <String, String> Foo<Integer>(1);
}

View File

@@ -92,7 +92,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
doTest(false, false);
}
public void testDiamondPos8() throws Exception {
public void testDiamondNeg15() throws Exception {
doTest(false, false);
}