Project: JDT
Bug 160283 [clean up] Convert iterable loop ignores block change settings
Reported: 2006-10-10 06:22:11 | Status: resolved fixed

I20061003-0800 Given: package test1; import java.util.Iterator; import java.util.List; public class E1 { void bar(List<Object> x) { for (Iterator<Object> i = x.iterator(); i.hasNext();) { System.out.println(i.next()); } } } Clean Ups: - Remove unnecessary blocks - Convert for loops to enhanced for loops Is: for (Object object : x) { System.out.println(object); } Should: for (Object object : x) System.out.println(object); And given: package test1; import java.util.Iterator; import java.util.List; public class E2 { void bar(List<Object> x) { for (Iterator<Object> i = x.iterator(); i.hasNext();) System.out.println(i.next()); } } Clean Ups: - Convert control statement bodies to block - Convert for loops to enhanced for loops Is: for (Object object : x) System.out.println(object); Should: for (Object object : x) { System.out.println(object); }

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