Bug 85831 Organize imports add an unused import [code manipulation]
Using I20050215-2300, run Organize import on this source: package test0069; class Outer<A> { class Inner<B> { } } public class X { test0069.Outer<String>.Inner<Integer> in = new Outer<String>().new Inner<Integer>(); } It adds import test0069.Outer.Inner; that is never used.
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/ScopeAnalyzerTest.java
buf.append("    public static class E1 extends G {\n");
		buf.append("        public static class EE1 {\n");
		buf.append("        }\n");
		buf.append("        public static class EE2 {\n");
		buf.append("        }\n");
		buf.append("    }\n");
		buf.append("    public static class E2 {\n");
		buf.append("    }\n");				
		buf.append("}\n");		
		buf.append("class F extends E.E1{\n");
		buf.append("    F f1;\n");
		buf.append("}\n");
		buf.append("class G {\n");
		buf.append("    public static class G1 {\n");
		buf.append("    }\n");
		buf.append("}\n");		
		ICompilationUnit compilationUnit= pack1.createCompilationUnit("E.java", buf.toString(), false, null);		
		
		CompilationUnit astRoot= createAST(compilationUnit);
		assertNoProblems(astRoot);
		{
			String str= "F f1;";
			int offset= buf.toString().indexOf(str);
	
			int flags= ScopeAnalyzer.TYPES;
			IBinding[] res= new ScopeAnalyzer(astRoot).getDeclarationsInScope(offset, flags);
			
			assertVariables(res, new String[] { "F", "EE1", "EE2", "G1", "G", "E"});
		}
	}