Bug 123766 [clean up] remove unused field does not remove decl if multible fragments
Version: 3.2.0 Build id: I20060110-1026 Given: package test1; public class E1 { private int i,j; } remove unused private fields results in: package test1; public class E1 { private int; } should be: package test1; public class E1 { }
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest.java
IPackageFragment pack2= fSourceFolder.createPackageFragment("test2", false, null);
		buf= new StringBuffer();
		buf.append("package test2;\n");
		buf.append("import java.util.HashMap;\n");
		buf.append("import test1.E2;\n");
		buf.append("import java.io.StringReader;\n");
		buf.append("import java.util.HashMap;\n");
		buf.append("public class E3 extends E2 {\n");
		buf.append("}\n");
		ICompilationUnit cu3= pack2.createCompilationUnit("E3.java", buf.toString(), false, null);
		
		ICleanUp cleanUp= new UnusedCodeCleanUp(UnusedCodeCleanUp.REMOVE_UNUSED_IMPORTS);
		
		setOptions(cleanUp);
		
		CompilationUnit[] units= compile(new ICompilationUnit[] {cu1, cu2, cu3});
		assertNumberOfProblems(units[0], 1);
		assertNumberOfProblems(units[1], 2);
		assertNumberOfProblems(units[2], 3);
		
		buf= new StringBuffer();
		buf.append("package test1;\n");
		buf.append("public class E1 {\n");
		buf.append("    public void foo() {\n");
		buf.append("    }\n");
		buf.append("}\n");
		String expected1= buf.toString();
		
		buf= new StringBuffer();