mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
no enclosing instance error for top level classes (IDEA-169088)
This commit is contained in:
+2
-1
@@ -784,7 +784,8 @@ public class HighlightClassUtil {
|
||||
if (!PsiUtil.isInnerClass(base)) return;
|
||||
|
||||
if (resolve == resolved && baseClass != null && (!PsiTreeUtil.isAncestor(baseClass, extendRef, true) || aClass.hasModifierProperty(PsiModifier.STATIC)) &&
|
||||
!InheritanceUtil.hasEnclosingInstanceInScope(baseClass, extendRef, !aClass.hasModifierProperty(PsiModifier.STATIC), true) && !qualifiedNewCalledInConstructors(aClass)) {
|
||||
!InheritanceUtil.hasEnclosingInstanceInScope(baseClass, extendRef, PsiUtil.isInnerClass(aClass) && !aClass.hasModifierProperty(PsiModifier.STATIC), true) &&
|
||||
!qualifiedNewCalledInConstructors(aClass)) {
|
||||
String description = JavaErrorMessages.message("no.enclosing.instance.in.scope", HighlightUtil.formatClass(baseClass));
|
||||
infos[0] = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(extendRef).descriptionAndTooltip(description).create();
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Outer {
|
||||
class Inner extends Outer {}
|
||||
}
|
||||
|
||||
class Impl extends <error descr="No enclosing instance of type 'Outer' is in scope">Outer.Inner</error> {}
|
||||
@@ -630,4 +630,8 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testUncheckedWarningWhenCastingFromCapturedWildcard() throws Exception {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_8, true);
|
||||
}
|
||||
|
||||
public void testEnclosingRefInTopLevelClassExtendingInnerWhichExtendsItsOuter() throws Exception {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_8, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user