Bug 73890 [1.5] Convert to enhanced for loop quick assist should not be available if counter is used in loop
I20040907 Have the following: for (int i= 0, length= numbers.length; i < length; i++) { int number= numbers[i]; System.out.println("Number " + i + ": " + new Integer(numbers[i])); } The quick assist allows me to convert this into code which causes a compile error: for (int element : numbers) { System.out.println("Number " + i + ": " + new Integer(numbers[i])); } Note: if I first assign int number= numbers[i]; and use number instead of numbers[i] in the println then the quick assist is not offered (correct).
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertForLoopQuickFixTest.java
}
	public static Test suite() {
		if (true) {
			return allTests();
		} else {
			TestSuite suite= new TestSuite();
			suite.addTest(new ConvertForLoopQuickFixTest("testSimplestClean"));
			return new ProjectTestSetup(suite);
		}
	}
	protected void setUp() throws Exception {
		Hashtable options= TestOptions.getFormatterOptions();
		options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
		options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
		JavaCore.setOptions(options);
		IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
		store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
		fJProject1= ProjectTestSetup.getProject();
		fSourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
		fConvertLoopProposal= null;
	}
	protected void tearDown() throws Exception {
		JavaProjectHelper.clear(fJProject1, ProjectTestSetup.getDefaultClasspath());
	}
	public void testSimplestSmokeCase() throws Exception {
		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
		StringBuffer buf= new StringBuffer();
		buf.append("package test1;\n");
		buf.append("public class A {\n");
		buf.append("    public void foo() {\n");