IDEA-380311 [java-highlighting] Invalid code "cannot referenced from static context" not highlighted properly in Java

Follow-up: proper qualified references handling


(cherry picked from commit c7f470065ab5c4ad97c9fb6ba02d6fa603e62a84)

IJ-CR-194233

GitOrigin-RevId: 62df1ea06043b6475aa868ab70f0f413261c89d6
This commit is contained in:
Tagir Valeev
2026-03-04 10:47:55 +00:00
committed by intellij-monorepo-bot
parent a4f2bd1574
commit 132f486314
3 changed files with 44 additions and 0 deletions
@@ -1700,6 +1700,10 @@ final class ExpressionChecker {
newExpression.getClassOrAnonymousClassReference() == expression) {
return;
}
if (parent instanceof PsiNewExpression newExpression && newExpression.getQualifier() != null) {
// The qualifier will be checked instead
return;
}
if (parent instanceof PsiThisExpression || parent instanceof PsiSuperExpression) return;
}
if (!(expression instanceof PsiThisExpression) && !(expression instanceof PsiSuperExpression) ||