Bug 67644 "Organize Imports" imports inner classes but the compiler think it unnecessary [code manipulation]
Here is an example. There are two packages, a and b. Class A is in package a, with an inner class named AA (showed in the code following). ----- A.java --------------------------------------- package a; public class A { public class AA { }; } And there is a class named B in package b that use class A and A.AA: ----- B.java ----------------------------- package b; public class B { public void useA() { A a = new A(); A.AA aa = a.new AA(); } } If I use the "Organize Imports" command, it will add two import statements: import a.A; import a.A.AA; But after that, the compiler shows a warning, saying that "the import a.A.AA is never used".
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/ImportOrganizeTest.java
buf.append("import java.util.*;\n");
		buf.append("\n");
		buf.append("import org.eclipse.core.runtime.IAdaptable;\n");
		buf.append("import org.eclipse.swt.accessibility.ACC;\n");
		buf.append("import org.eclipse.swt.accessibility.AccessibleControlEvent;\n");
		buf.append("\n");		
		buf.append("import org.eclipse.gef.*;\n");
		buf.append("\n");
		buf.append("import org.eclipse.draw2d.IFigure;\n");
		buf.append("import org.eclipse.draw2d.LayoutManager;\n");
		buf.append("import org.eclipse.draw2d.geometry.Point;\n");
		buf.append("import org.eclipse.draw2d.geometry.Rectangle;\n");
		buf.append("\n");
		buf.append(body.toString());
		assertEqualString(cu.getSource(), buf.toString());
	}
	
	public void test_bug25113() throws Exception {
		String[] types= new String[] {
			"com.mycompany.Class1",
			"com.foreigncompany.Class2",
			"com.foreigncompany.Class3",
			"com.mycompany.Class4",
			"com.misc.Class5"
		};
		String[] order= new String[] { "com", "com.foreigncompany", "com.mycompany" };
		int threshold= 99;
		IPackageFragmentRoot sourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
		for (int i= 0; i < types.length; i++) {
			String pack= Signature.getQualifier(types[i]);