diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/JavaResolveUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/JavaResolveUtil.java index b60524d331ee..9fc420fd261b 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/JavaResolveUtil.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/JavaResolveUtil.java @@ -183,7 +183,7 @@ public class JavaResolveUtil { PsiClass lastClass = null; Boolean isAtLeast17 = null; for (PsiElement placeParent = place; placeParent != null; placeParent = placeParent.getContext()) { - if (placeParent instanceof PsiClass && !(placeParent instanceof PsiAnonymousClass)) { + if (placeParent instanceof PsiClass) { final boolean isTypeParameter = placeParent instanceof PsiTypeParameter; if (isTypeParameter && isAtLeast17 == null) { isAtLeast17 = JavaVersionService.getInstance().isAtLeast(place, JavaSdkVersion.JDK_1_7); diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA78916.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA78916.java new file mode 100644 index 000000000000..214a3aec4bd6 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA78916.java @@ -0,0 +1,38 @@ +enum EnumPrivateMethodTest { + FIRST { + @Override + public void execute() { + this.firstMethod(); + } + }; + + public abstract void execute(); + + private void firstMethod() {} +} + +abstract class EnumPrivateMethodTest1 { + EnumPrivateMethodTest1 FIRST = new EnumPrivateMethodTest1() { + @Override + public void execute() { + this.firstMethod(); + } + }; + + public abstract void execute(); + + private void firstMethod() {} +} + +abstract class EnumPrivateMethodTest2 { + EnumPrivateMethodTest2 FIRST = new EnumPrivateMethodTest2() { + @Override + public void execute() { + firstMethod(); + } + }; + + public abstract void execute(); + + private void firstMethod() {} +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java index fb4fedebb121..278de8c28a89 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java @@ -179,4 +179,5 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase { public void testIDEA70890() { doTest(false, false); } public void testIDEA63731() { doTest(false, false); } public void testIDEA62056() { doTest(false, false); } + public void testIDEA78916() { doTest(false, false); } }