mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
+12
-9
@@ -65,20 +65,23 @@ public class GrImportStatementImpl extends GroovyPsiElementImpl implements GrImp
|
||||
if (isOnDemand()) {
|
||||
GrCodeReferenceElement ref = getImportReference();
|
||||
if (ref != null) {
|
||||
String qName = PsiUtil.getQualifiedReferenceText(ref);
|
||||
if (qName != null) {
|
||||
if (!isStatic()) {
|
||||
if (isStatic()) {
|
||||
final PsiElement resolved = ref.resolve();
|
||||
if (resolved instanceof PsiClass) {
|
||||
final PsiClass clazz = (PsiClass)resolved;
|
||||
if (clazz != null) {
|
||||
if (!processAllMembers(processor, clazz)) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
String qName = PsiUtil.getQualifiedReferenceText(ref);
|
||||
if (qName != null) {
|
||||
PsiPackage aPackage = facade.findPackage(qName);
|
||||
if (aPackage != null) {
|
||||
if (!aPackage.processDeclarations(processor, state, lastParent, place)) return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
final PsiClass clazz = facade.findClass(qName, getResolveScope());
|
||||
if (clazz != null) {
|
||||
if (!processAllMembers(processor, clazz)) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +113,13 @@ public class ResolveClassTest extends GroovyResolveTestCase {
|
||||
assertEquals("java.util.ArrayList", ((PsiClass)resolved).getQualifiedName());
|
||||
}
|
||||
|
||||
public void testNotQualifiedStaticImport() throws Exception {
|
||||
myFixture.addFileToProject("foo/A.groovy", "package foo \nclass Foo{ }");
|
||||
PsiReference ref = configureByFile("notQualifiedStaticImport/Test.groovy");
|
||||
final PsiElement resolved = ref.resolve();
|
||||
assertInstanceOf(resolved, PsiClass.class);
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(getTestName(true) + "/" + getTestName(false) + ".groovy");
|
||||
}
|
||||
|
||||
+13
-2
@@ -441,7 +441,7 @@ print new Foo().fo<caret>o""")
|
||||
def resolved = ref.resolve();
|
||||
assertInstanceOf resolved, GrAccessorMethod.class
|
||||
}
|
||||
|
||||
|
||||
public void testPropertyAndFieldDeclarationWithSuperClass4() {
|
||||
myFixture.configureByText("a.groovy", """
|
||||
class Bar{
|
||||
@@ -500,7 +500,7 @@ set<caret>Bar(2)
|
||||
assertNull resolved
|
||||
}
|
||||
|
||||
public void resolvePropertyInCallExpression() {
|
||||
public void testPropertyInCallExpression() {
|
||||
myFixture.configureByText("a.groovy", """
|
||||
class Foo {
|
||||
def foo = {
|
||||
@@ -518,4 +518,15 @@ new Foo().fo<caret>o(2)"""
|
||||
|
||||
assertInstanceOf resolved, GrAccessorMethod
|
||||
}
|
||||
|
||||
public void testPropertyImportedOnDemand() {
|
||||
myFixture.addFileToProject("foo/A.groovy", 'package foo; class Foo {static def foo}')
|
||||
myFixture.configureByText("B.groovy", """package foo
|
||||
import static Foo.*
|
||||
print fo<caret>o""")
|
||||
|
||||
def ref = findReference()
|
||||
def resolved = ref.resolve()
|
||||
assertInstanceOf(resolved, GrAccessorMethod)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package foo
|
||||
|
||||
import static Fo<ref>o.*
|
||||
Reference in New Issue
Block a user