check if current class doesn't have access to siblings (IDEA-19200)

This commit is contained in:
anna
2013-05-03 17:21:31 +02:00
parent e9e7ce005d
commit ee964486c9
3 changed files with 13 additions and 1 deletions
@@ -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();
}
@@ -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();
}