mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java: check enum instantiation before constructor applicability (IDEA-267280)
GitOrigin-RevId: f7f2a0ac939fd6ae08a1919335bcebd1098ff6e7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9aaa8d5861
commit
01a5ea5835
+1
-1
@@ -1106,11 +1106,11 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkCreateInnerClassFromStaticContext(expression, type, aClass));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkTypeParameterInstantiation(expression));
|
||||
if (aClass != null && !myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkInstantiationOfAbstractClass(aClass, expression));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkEnumInstantiation(expression, aClass));
|
||||
try {
|
||||
if (!myHolder.hasErrorResults()) HighlightMethodUtil.checkNewExpression(expression, type, myHolder, myJavaSdkVersion);
|
||||
}
|
||||
catch (IndexNotReadyException ignored) { }
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkEnumInstantiation(expression, aClass));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkGenericArrayCreation(expression, type));
|
||||
if (!myHolder.hasErrorResults()) registerConstructorCall(expression);
|
||||
|
||||
|
||||
+2
@@ -2,6 +2,7 @@ import java.util.*;
|
||||
public class MyEnum {
|
||||
|
||||
enum Test {A,B}
|
||||
enum Test1 {A; Test1() {}}
|
||||
|
||||
public static Test[] accepted1() {
|
||||
List<Test> list = new ArrayList<Test>();
|
||||
@@ -13,4 +14,5 @@ public class MyEnum {
|
||||
}
|
||||
|
||||
Test t = <error descr="Enum types cannot be instantiated">new Test()</error>;
|
||||
Test1 t1 = <error descr="Enum types cannot be instantiated">new Test1()</error>;
|
||||
}
|
||||
Reference in New Issue
Block a user