Project: JDT
Bug 130293 [quick assist] Convert to enhanced for loop not applicable for field accesses
Reported: 2006-03-03 05:33:35 | Status: resolved fixed

I20060301-0800 Given: package test; public class E { private int[] arr; public void foo() { for (int i = 0; i < this.arr.length; i++) { System.out.println(this.arr[i]); } } } or: package test; public class E { private class E1Sub { public int[] array; } private E1Sub e1sub; public void foo() { for (int i = 0; i < this.e1sub.array.length; i++) { System.out.println(this.e1sub.array[i]); } } } Convert to enhanced for loop should be applicable and generate: for (int element : this.arr) { System.out.println(element); } and: for (int element : this.e1sub.array) { System.out.println(element); }

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest.java org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertForLoopQuickFixTest.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/ConvertForLoopOperation.java