mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
check if current class doesn't have access to siblings (IDEA-19200)
This commit is contained in:
+1
-1
@@ -778,7 +778,7 @@ public class HighlightClassUtil {
|
||||
if (!PsiUtil.isInnerClass(base)) return;
|
||||
|
||||
if (resolve == resolved && baseClass != null && (!PsiTreeUtil.isAncestor(baseClass, extendRef, true) || aClass.hasModifierProperty(PsiModifier.STATIC)) &&
|
||||
!hasEnclosingInstanceInScope(baseClass, extendRef, true, true) && !qualifiedNewCalledInConstructors(aClass, baseClass)) {
|
||||
!hasEnclosingInstanceInScope(baseClass, extendRef, !aClass.hasModifierProperty(PsiModifier.STATIC), true) && !qualifiedNewCalledInConstructors(aClass, baseClass)) {
|
||||
String description = JavaErrorMessages.message("no.enclosing.instance.in.scope", HighlightUtil.formatClass(baseClass));
|
||||
infos[0] = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(extendRef).descriptionAndTooltip(description).create();
|
||||
}
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
class Test1 extends Test {}
|
||||
static class Test2 extends <error descr="No enclosing instance of type 'Test' is in scope">Test1</error> {}
|
||||
|
||||
|
||||
static class Test11 extends Test {}
|
||||
static class Test21 extends Test11 {}
|
||||
}
|
||||
@@ -365,6 +365,10 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA60875() { doTest(false, false); }
|
||||
public void testIDEA71645() { doTest(false, false); }
|
||||
|
||||
public void testNoEnclosingInstanceWhenStaticNestedInheritsFromContainingClass() throws Exception {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testStaticMethodCalls() {
|
||||
doTestFile(BASE_PATH + "/" + getTestName(false) + ".java").checkSymbolNames().test();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user