mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 17:20:55 +07:00
Java: fix good code is red super() call problem 2 (IDEA-340994)
"Cannot reference class before supertype constructor has been called" GitOrigin-RevId: 510ee2de490dce949a0926303de39e69c998e6e3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0b42cca24f
commit
6b8d6303b4
@@ -2747,6 +2747,7 @@ public final class HighlightUtil {
|
||||
}
|
||||
}
|
||||
else if (resolved instanceof PsiClass aClass) {
|
||||
if (expression instanceof PsiReferenceExpression) return null;
|
||||
if (aClass.hasModifierProperty(PsiModifier.STATIC)) return null;
|
||||
referencedClass = aClass.getContainingClass();
|
||||
if (referencedClass == null) return null;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
class FirstLevel {
|
||||
FirstLevel(int i) {
|
||||
}
|
||||
|
||||
int hello() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
class SecondLevel extends FirstLevel {
|
||||
SecondLevel() {
|
||||
super(1);
|
||||
}
|
||||
|
||||
|
||||
class ThirdLevel extends FirstLevel {
|
||||
ThirdLevel() {
|
||||
super(SecondLevel.h());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int h() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,6 +380,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testExplicitConstructorInvocation() { doTest(false); }
|
||||
public void testExtendFinalClass() { doTest(false); }
|
||||
public void testPrivateMethodCalledFromSuper() { doTest(false); }
|
||||
public void testReferenceToClassFromSuper() { IdeaTestUtil.withLevel(getModule(), LanguageLevel.JDK_16, () -> doTest(false)); }
|
||||
public void testThisInInterface() { doTest(false); }
|
||||
public void testInnerClassConstantReference() { doTest(false); }
|
||||
public void testIDEA60875() { doTest(false); }
|
||||
|
||||
Reference in New Issue
Block a user