mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-highlighting] IDEA-304893 allow array init before super
GitOrigin-RevId: 9a20ede1944cfc2d9511753ba9490c5beb94b21e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4fb2e28c3e
commit
c83b6fd069
+6
@@ -2811,6 +2811,12 @@ public final class HighlightUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (expression instanceof PsiJavaCodeReferenceElement &&
|
||||
expression.getParent() instanceof PsiNewExpression newExpression &&
|
||||
newExpression.isArrayCreation() && newExpression.getClassOrAnonymousClassReference() == expression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
HighlightInfo.Builder builder = createMemberReferencedError(resolvedName, expression.getTextRange());
|
||||
if (expression instanceof PsiReferenceExpression ref && PsiUtil.isInnerClass(parentClass)) {
|
||||
String referenceName = ref.getReferenceName();
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
public class ArrayInitBeforeSuper {
|
||||
public static void main(String[] args) {
|
||||
}
|
||||
|
||||
public class Example extends Zuper{
|
||||
public class Inner{
|
||||
}
|
||||
Example() {
|
||||
super(new Inner[]{}); // <<<< NOT ERROR
|
||||
}
|
||||
}
|
||||
|
||||
class Zuper {
|
||||
Zuper(Example.Inner[] inners) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
@@ -442,4 +442,8 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testUninitializedVarComplexTernary() {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
public void testArrayInitBeforeSuper() {
|
||||
doTest(false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user