mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
reject type args for constructor of a class without type params (IDEA-102239)
This commit is contained in:
+1
@@ -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;
|
||||
}
|
||||
|
||||
+22
@@ -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();
|
||||
}
|
||||
}
|
||||
+4
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user