error preferences according to javac (IDEA-180509)

This commit is contained in:
Anna.Kozlova
2018-03-14 19:03:48 +01:00
parent ae17453dcc
commit 6880a7c7a7
4 changed files with 17 additions and 4 deletions

View File

@@ -2625,10 +2625,7 @@ public class HighlightUtil extends HighlightUtilBase {
PsiElement refName = ref.getReferenceNameElement();
if (!(refName instanceof PsiIdentifier) && !(refName instanceof PsiKeyword)) return null;
PsiElement resolved = result.getElement();
HighlightInfo highlightInfo = checkMemberReferencedBeforeConstructorCalled(ref, resolved, containingFile);
if (highlightInfo != null) return highlightInfo;
PsiElement refParent = ref.getParent();
PsiElement granny;
if (refParent instanceof PsiReferenceExpression && (granny = refParent.getParent()) instanceof PsiMethodCallExpression) {

View File

@@ -1196,6 +1196,8 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkPackageAndClassConflict(ref, myFile));
if (!myHolder.hasErrorResults() && resolved instanceof PsiClass) myHolder.add(HighlightUtil.checkLegalVarReference(ref, (PsiClass)resolved));
if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkMemberReferencedBeforeConstructorCalled(ref, resolved, myFile));
return result;
}

View File

@@ -0,0 +1,13 @@
class Test {
static class A {
private int a;
A(final int a) {}
}
static class B extends A {
B() {
super(<error descr="'a' has private access in 'Test.A'">a</error>);
}
}
}

View File

@@ -431,4 +431,5 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testCaptureForBoundCheck() { doTest6(false); }
public void testGetClassInAnonymous() { doTest6(false); }
public void testInheritFromDifferentParameterizations() { doTest6(false); }
public void testCheckAccessibilityBeforeSuperFieldReferenceInSuperCall() { doTest6(false); }
}