Project: JDT
Bug 160218 [clean up] MalformedTreeExcpetion on converting iterable loop
Reported: 2006-10-09 10:49:31 | Status: resolved fixed

I20061003-0800 Given: package test1; import java.util.Iterator; import java.util.List; public class E1 { void bar(List<Number> x) { if (true) { for (Iterator<Number> i = x.iterator(); i.hasNext();) System.out.println(i.next()); } } } Clean Ups: - Remove unnecessary blocks - Convert for loops to enhanced for loops 1. Run Clean Up on E1 Is: org.eclipse.text.edits.MalformedTreeException: Source edit has different target edit. at org.eclipse.text.edits.MoveTargetEdit.performConsistencyCheck(MoveTargetEdit.java:143) at org.eclipse.text.edits.TextEdit.traverseConsistencyCheck(TextEdit.java:870) at org.eclipse.text.edits.MoveTargetEdit.traverseConsistencyCheck(MoveTargetEdit.java:133) at org.eclipse.text.edits.TextEdit.traverseConsistencyCheck(TextEdit.java:866) at org.eclipse.text.edits.TextEdit.traverseConsistencyCheck(TextEdit.java:866) at org.eclipse.text.edits.TextEditProcessor.checkIntegrityDo(TextEditProcessor.java:168) at org.eclipse.text.edits.TextEdit.dispatchCheckIntegrity(TextEdit.java:740) at org.eclipse.text.edits.TextEditProcessor.performEdits(TextEditProcessor.java:149) at org.eclipse.ltk.core.refactoring.TextChange.perform(TextChange.java:240) at org.eclipse.ltk.core.refactoring.CompositeChange.perform(CompositeChange.java:278) at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChange.access$0(DynamicValidationStateChange.java:1) at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChange$1.run(DynamicValidationStateChange.java:92) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1737) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4050) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4007) at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChange.perform(DynamicValidationStateChange.java:95) at org.eclipse.ltk.core.refactoring.PerformChangeOperation$1.run(PerformChangeOperation.java:232) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1737) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1719) at org.eclipse.ltk.core.refactoring.PerformChangeOperation.executeChange(PerformChangeOperation.java:280) at org.eclipse.ltk.internal.ui.refactoring.UIPerformChangeOperation.executeChange(UIPerformChangeOperation.java:109) at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:197) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1737) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4050) at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313) at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:767) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:764) at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2280) at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper.perform(RefactoringExecutionHelper.java:172) at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper.perform(RefactoringExecutionHelper.java:137) at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter.startCleanupRefactoring(RefactoringExecutionStarter.java:260) at org.eclipse.jdt.internal.ui.actions.CleanUpAction.run(CleanUpAction.java:158) at org.eclipse.jdt.internal.ui.actions.CleanUpAction.run(CleanUpAction.java:80) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:272) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:244) at org.eclipse.jface.action.Action.runWithEvent(Action.java:499) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3398) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3022) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1916) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1880) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:348) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:165) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:341) at org.eclipse.core.launcher.Main.basicRun(Main.java:285) at org.eclipse.core.launcher.Main.run(Main.java:987) at org.eclipse.core.launcher.Main.main(Main.java:962)

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/ConvertIterableLoopOperation.java