mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
java resolve: prefer package for single-type-import only with default package exception (IDEA-206295)
This commit is contained in:
@@ -526,7 +526,8 @@ 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, PsiImportStatement.class) != null) {
|
||||
PsiImportStatement importStatement = PsiTreeUtil.getParentOfType(this, PsiImportStatement.class);
|
||||
if (importStatement != null && (!importStatement.isOnDemand() || !isQualified())) {
|
||||
result = resolve(Kind.PACKAGE_NAME_KIND, containingFile);
|
||||
if (result.length == 0) {
|
||||
result = resolve(classKind, containingFile);
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package a;
|
||||
|
||||
import foo.Bar.*;
|
||||
|
||||
class MyTest {
|
||||
private void foo(Inner inner) {}
|
||||
}
|
||||
@@ -55,6 +55,12 @@ public class LightAdvHighlightingFixtureTest extends LightCodeInsightFixtureTest
|
||||
assertNull(ReferencesSearch.search(aClass).findFirst());
|
||||
}
|
||||
|
||||
public void testPackageNameAsClassFQName() {
|
||||
myFixture.addClass("package foo.Bar; class A {}");
|
||||
myFixture.addClass("package foo; public class Bar { public static class Inner {}}");
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInaccessibleFunctionalTypeParameter() {
|
||||
myFixture.addClass("package test; class A {}");
|
||||
myFixture.addClass("package test; public interface I { void m(A a);}");
|
||||
|
||||
Reference in New Issue
Block a user