mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
forbid default package classes in static imports (IDEA-26971 )
This commit is contained in:
@@ -2173,6 +2173,13 @@ public class HighlightUtil {
|
||||
}
|
||||
if ((resolved instanceof PsiLocalVariable || resolved instanceof PsiParameter) && !(resolved instanceof ImplicitVariable)) {
|
||||
highlightInfo = HighlightControlFlowUtil.checkVariableMustBeFinal((PsiVariable)resolved, ref);
|
||||
} else if (resolved instanceof PsiClass) {
|
||||
if (Comparing.strEqual(((PsiClass)resolved).getQualifiedName(), ((PsiClass)resolved).getName())) {
|
||||
final PsiElement parent = ref.getParent();
|
||||
if (parent instanceof PsiImportStaticReferenceElement || parent instanceof PsiImportStaticStatement) {
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.WRONG_REF, refName, JavaErrorMessages.message("cannot.resolve.symbol", refName.getText()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return highlightInfo;
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import static <error descr="Cannot resolve symbol 'MyConstants'">MyConstants</error>.*;
|
||||
|
||||
public class MyClient
|
||||
{
|
||||
private int field = MyConstants.CONSTANT;
|
||||
}
|
||||
|
||||
class MyConstants
|
||||
{
|
||||
public static final int CONSTANT = 1;
|
||||
}
|
||||
@@ -175,6 +175,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEADEV13249() throws Exception { doTest(false, false); }
|
||||
public void testIDEADEV11919() throws Exception { doTest(false, false); }
|
||||
public void testMethodCannotBeApplied() throws Exception { doTest(false, false); }
|
||||
public void testDefaultPackageClassInStaticImport() throws Exception { doTest(false, false); }
|
||||
|
||||
public void testUnusedParamsOfPublicMethod() throws Exception { doTest(true, false); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user