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/ui/org/eclipse/jdt/internal/ui/text/correction/ConvertForLoopProposal.java
}
	private boolean is5_0_Source() {
		IJavaProject project= getCompilationUnit().getJavaProject();
		String version= project.getOption("org.eclipse.jdt.core.compiler.compliance", true); 
		return JavaCore.VERSION_1_5.equals(version);
	}
	private boolean typeBindingsAreNotNull() {
		fIndexBinding= getIndexBinding();
		return fOldCollectionBinding != null && fOldCollectionTypeBinding != null && fIndexBinding != null;
	}
	
	private boolean bodySatifiesPreconditions() {
		
		
		final List writeAccesses= new ArrayList();
		final boolean isIndexReferenced[]= {false};
		
		fOldForStatement.getBody().accept(new ASTVisitor() {
			public boolean visit(Assignment assignment) {
				classifyWriteAccess(assignment.getLeftHandSide());
				return true;
			}
			public boolean visit(PostfixExpression node) {
				classifyWriteAccess(node.getOperand());
				return true;
			}
			public boolean visit(PrefixExpression node) {
				classifyWriteAccess(node.getOperand());
				return true;
			}