mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-120028 Groovy: "Optimize imports": static keyword is removed from unresolved imports
This commit is contained in:
@@ -227,16 +227,23 @@ public class GroovyImportOptimizer implements ImportOptimizer {
|
||||
usedImports.add(anImport);
|
||||
}
|
||||
|
||||
final String className = getImportReferenceText(anImport);
|
||||
final String symbolName = getImportReferenceText(anImport);
|
||||
|
||||
if (anImport.isAliasedImport()) {
|
||||
if (aliased != null) {
|
||||
aliased.put(className, importedName);
|
||||
aliased.put(symbolName, importedName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (importedClasses != null) {
|
||||
importedClasses.add(className);
|
||||
if (anImport.isStatic()) {
|
||||
if (staticallyImportedMembers != null) {
|
||||
staticallyImportedMembers.add(symbolName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (importedClasses != null) {
|
||||
importedClasses.add(symbolName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -150,6 +150,8 @@ public class OptimizeImportsTest extends LightGroovyTestCase {
|
||||
public void testDontRemoveRedImports5() { doTest(); }
|
||||
public void testDontRemoveRedImports6() { doTest(); }
|
||||
public void testDontRemoveRedImports7() { doTest(); }
|
||||
public void testDontRemoveRedImports8() { doTest(); }
|
||||
public void testDontRemoveRedImports9() { doTest(); }
|
||||
|
||||
public void testRemoveSamePackaged() {
|
||||
myFixture.addClass("package foo.bar; public class Aaaa {}");
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import static abc.X.foo
|
||||
import static abc.X.bar
|
||||
|
||||
print foo()
|
||||
@@ -0,0 +1,3 @@
|
||||
import static abc.X.foo
|
||||
|
||||
print foo()
|
||||
@@ -0,0 +1,4 @@
|
||||
import static abc.X.foo as bar
|
||||
import static abc.X.baz as xyz
|
||||
|
||||
print bar()
|
||||
@@ -0,0 +1,3 @@
|
||||
import static abc.X.foo as bar
|
||||
|
||||
print bar()
|
||||
Reference in New Issue
Block a user