mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
private method is not available from anonymous class via this (IDEA-78916)
This commit is contained in:
@@ -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);
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
enum EnumPrivateMethodTest {
|
||||
FIRST {
|
||||
@Override
|
||||
public void execute() {
|
||||
this.<error descr="'firstMethod()' has private access in 'EnumPrivateMethodTest'">firstMethod</error>();
|
||||
}
|
||||
};
|
||||
|
||||
public abstract void execute();
|
||||
|
||||
private void firstMethod() {}
|
||||
}
|
||||
|
||||
abstract class EnumPrivateMethodTest1 {
|
||||
EnumPrivateMethodTest1 FIRST = new EnumPrivateMethodTest1() {
|
||||
@Override
|
||||
public void execute() {
|
||||
this.<error descr="'firstMethod()' has private access in 'EnumPrivateMethodTest1'">firstMethod</error>();
|
||||
}
|
||||
};
|
||||
|
||||
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() {}
|
||||
}
|
||||
+1
@@ -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); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user