Bug 129165 [quick fix] 'Change modifier to final' changes order of variable decl fragments
I20060221-1300 Given: int i= 1, j= i + 1, h= j + 1; Serializable ser= new Serializable() { void foo() { System.out.println(j); } }; Then make j final with quick fix 'Change modifier of 'j' to final' Result: int i= 1, h= j + 1; final int j= i + 1; Serializable ser= new Serializable() { void foo() { System.out.println(j); } }; Expected: int i= 1; final int j= i + 1; int h= j + 1; Serializable ser= new Serializable() { void foo() { System.out.println(j); } }; The order of the declarations must be preserved.
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ModifierCorrectionsQuickFixTest.java
assertNumberOfProposals(proposals, 1);
		assertCorrectLabels(proposals);
		
		CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
		String preview= getPreviewContent(proposal);
		buf= new StringBuffer();
		buf.append("package test1;\n");
		buf.append("public class C {\n");
		buf.append("    int fXoo;\n");
		buf.append("}\n");
		
		assertEqualString(preview, buf.toString());
	}
	
	
	public void testInvisibleFieldRequestedInSamePackage2() throws Exception {
		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
		StringBuffer buf= new StringBuffer();
		buf.append("package test1;\n");
		buf.append("public class C {\n");
		buf.append("    private int fXoo;\n");
		buf.append("}\n");
		pack1.createCompilationUnit("C.java", buf.toString(), false, null);
		buf= new StringBuffer();
		buf.append("package test1;\n");	
		buf.append("public class E extends C {\n");
		buf.append("    public void foo() {\n");
		buf.append("         fXoo= 1;\n");
		buf.append("    }\n");
		buf.append("}\n");