diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/toplevel/imports/GrImportStatementImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/toplevel/imports/GrImportStatementImpl.java index c98b1ac3f671..0dd309369323 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/toplevel/imports/GrImportStatementImpl.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/toplevel/imports/GrImportStatementImpl.java @@ -85,9 +85,9 @@ public class GrImportStatementImpl extends GroovyPsiElementImpl implements GrImp if (ref == null) return true; String qName = ref.getCanonicalText(); - if (qName.indexOf('.') <= 0) return true; if (isStatic()) { + if (qName.indexOf('.') <= 0) return true; final int i = qName.lastIndexOf('.'); if (i > 0) { final String classQName = qName.substring(0, i); diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveClassTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveClassTest.java index 47f34625ecb8..7def92277712 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveClassTest.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveClassTest.java @@ -132,6 +132,13 @@ public class ResolveClassTest extends GroovyResolveTestCase { assertNotNull(resolved); } + public void testAliasedImportedClassFromDefaultPackage() throws Exception { + myFixture.addClass("class Foo{}"); + final PsiReference ref = configureByFile("aliasedImportedClassFromDefaultPackage/Test.groovy"); + final PsiElement resolved = ref.resolve(); + assertNotNull(resolved); + } + private void doTest() throws Exception { doTest(getTestName(true) + "/" + getTestName(false) + ".groovy"); } diff --git a/plugins/groovy/testdata/resolve/class/aliasedImportedClassFromDefaultPackage/Test.groovy b/plugins/groovy/testdata/resolve/class/aliasedImportedClassFromDefaultPackage/Test.groovy new file mode 100644 index 000000000000..ced0c392093c --- /dev/null +++ b/plugins/groovy/testdata/resolve/class/aliasedImportedClassFromDefaultPackage/Test.groovy @@ -0,0 +1,3 @@ +import Foo as Bar + +Bar bar = new Bar() \ No newline at end of file