mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 18:28:55 +07:00
don't prefer packages in static imports (IDEA-168464)
This commit is contained in:
@@ -474,7 +474,7 @@ public class PsiJavaCodeReferenceElementImpl extends CompositePsiElement impleme
|
||||
|
||||
//A single-type-import declaration d in a compilation unit c of package p that imports a type named n shadows, throughout c, the declarations of:
|
||||
//any top level type named n declared in another compilation unit of p
|
||||
if (PsiTreeUtil.getParentOfType(this, PsiImportStatementBase.class) != null) {
|
||||
if (PsiTreeUtil.getParentOfType(this, PsiImportStatement.class) != null) {
|
||||
JavaResolveResult[] result = resolve(PACKAGE_NAME_KIND, containingFile);
|
||||
return result.length == 0 ? resolve(classKind, containingFile) : result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package p2;
|
||||
|
||||
import static p.P1.FOO;
|
||||
|
||||
class Bar {}
|
||||
@@ -105,6 +105,13 @@ public class LightAdvHighlightingFixtureTest extends LightCodeInsightFixtureTest
|
||||
myFixture.checkHighlighting();
|
||||
}
|
||||
|
||||
public void testStaticImportClassConflictingWithPackageName() throws Exception {
|
||||
myFixture.addClass("package p.P1; class Unrelated {}");
|
||||
myFixture.addClass("package p; public class P1 {public static final int FOO = 1;}");
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/advFixture";
|
||||
|
||||
Reference in New Issue
Block a user