reject type args for constructor of a class without type params (IDEA-102239)

This commit is contained in:
anna
2013-03-01 20:05:18 +01:00
parent 4fd6cc48b6
commit fcd09e4b99
3 changed files with 27 additions and 0 deletions
@@ -150,6 +150,7 @@ public class GenericsHighlightUtil {
final String description;
if (targetParametersNum == 0) {
if (PsiTreeUtil.getParentOfType(referenceParameterList, PsiCall.class) != null &&
typeParameterListOwner instanceof PsiMethod &&
JavaVersionService.getInstance().isAtLeast(referenceParameterList, JavaSdkVersion.JDK_1_7)) {
description = null;
}
@@ -0,0 +1,22 @@
class Foo {
{
Foo f = new Foo<error descr="Type 'Foo' does not have type parameters"><String></error>();
Foo.<String>foo();
}
static void foo() {}
}
class Bar {
<T> Bar() {}
{
Bar b = new <String>Bar();
}
}
class Baz {
Baz() {}
{
Baz b = new <String>Baz();
}
}
@@ -167,4 +167,8 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
public void testAmbiguousMethodCallIDEA97983() throws Exception { doTest(false, false); }
public void testAmbiguousMethodCallIDEA100314() throws Exception { doTest(false, false); }
public void testInstanceMemberNotAccessibleInStaticContext() throws Exception { doTest(false, false); }
public void testRejectedTypeParamsForConstructor() throws Exception {
doTest(false, false);
}
}