Project: JDT
Bug 129508 [quick assist] convert to enhanced for should not be applicable sometimes
Reported: 2006-02-26 18:54:29 | Status: resolved fixed

3.2M5 convert should not be applicable here for (Iterator<Integer> iter = removed.iterator(); iter.hasNext();) { Integer id = iter.next(); //do stuff iter.remove(); //after convert this is broken } or here for (Iterator<Integer> iter = removed.iterator(); iter.hasNext();) { Integer id = iter.next(); //do stuff boolean x= iter.hasNext(); //after convert this is broken } in general, whenever the iterator is used for anything else than the next() call, the conversion should be disabled. It's quite annoying to have to go back and fix those problems (revert to old code) after I just did clean up.

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertIterableLoopQuickFixTest.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/ConvertIterableLoopOperation.java