Project: JDT
Bug 16413 Strange "Organize Import" behavior
Reported: 2002-05-19 19:42:47 | Status: verified fixed

In the following scenario, organize imports adds an import that does not compile (says the import is not visible). Removing the import removes the error and everything compiles OK. I create a new project and add the folowing class to package a package a; public class ClassA { protected static interface InterfaceA { } public void methodA(InterfaceA a) { } } I then create the following class in package b (this class compiles) package b; import a.ClassA; public class ClassB extends ClassA { // Override of inherited method public void methodA(InterfaceA a) { super.methodA(a); } } Performing an "organize imports" on project B gives: package b; import a.ClassA; import a.ClassA.InterfaceA; /* this line won't compile */ public class ClassB extends ClassA { public void methodA(InterfaceA a) { super.methodA(a); } }

Files changed in fix:
org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/OrganizeImportsOperation.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/ASTNodes.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/JavaModelUtil.java