Project: JDT
Bug 135122 Java 1.5 - Optimize Imports adds abnormal "import static"
Reported: 2006-04-05 15:40:05 | Status: resolved fixed

Optimize Imports inserts unnecessary "import static" of class constant. // Example code package test; public class Bar { public void testMethod(String something) { } } // Subclass package test; // Unnecessary static import import static test.Foo.MYCONSTANT; public class Foo extends Bar { public static final String MYCONSTANT = ""; public void anotherMethod() { super.testMethod(MYCONSTANT); } } It seems as though the optimize imports function only adds the "import static" if the constant is used in a super()'s method. Eclipse then notifies the user that the import is never used locally and underlines yellow. Compiler doesn't seem to complain, however, it is mostly annoying and should not be there.

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/ImportOrganizeTest.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/ScopeAnalyzer.java