Project: JDT
Bug 202145 [clean up] overlapping text edits on save
Reported: 2007-09-04 06:58:38 | Status: resolved fixed

3.4 20070904 - I have the following clean ups on save enabled: Organize imports Remove trailing whitespaces Correct indentation - When saving the attached file I get the folloeing exception: org.eclipse.text.edits.MalformedTreeException: Overlapping text edits at org.eclipse.text.edits.TextEdit$InsertionComparator.compare(TextEdit.java:119) at java.util.Collections.indexedBinarySearch(Collections.java:322) at java.util.Collections.binarySearch(Collections.java:310) at org.eclipse.text.edits.TextEdit.computeInsertionIndex(TextEdit.java:793) at org.eclipse.text.edits.TextEdit.internalAdd(TextEdit.java:778) at org.eclipse.text.edits.TextEdit.addChild(TextEdit.java:333) at org.eclipse.jdt.internal.ui.fix.CodeFormatFix.createCleanUp(CodeFormatFix.java:135) at org.eclipse.jdt.internal.ui.fix.CodeFormatCleanUp.createFix(CodeFormatCleanUp.java:48) at org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring.calculateChange(CleanUpRefactoring.java:778) at org.eclipse.jdt.internal.corext.fix.CleanUpPostSaveListener.saved(CleanUpPostSaveListener.java:244) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider$6.run(CompilationUnitDocumentProvider.java:1506) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.notifyPostSaveListeners(CompilationUnitDocumentProvider.java:1501) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.commitWorkingCopy(CompilationUnitDocumentProvider.java:1303) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider$5.execute(CompilationUnitDocumentProvider.java:1367) at org.eclipse.ui.editors.text.TextFileDocumentProvider$DocumentProviderOperation.run(TextFileDocumentProvider.java:129) at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:68) at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:104) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797) at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:116) at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:73) at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:63) at org.eclipse.ui.editors.text.TextFileDocumentProvider.executeOperation(TextFileDocumentProvider.java:449) at org.eclipse.ui.editors.text.TextFileDocumentProvider.saveDocument(TextFileDocumentProvider.java:760) at org.eclipse.ui.texteditor.AbstractTextEditor.performSave(AbstractTextEditor.java:4718) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.performSave(CompilationUnitEditor.java:1216) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSave(CompilationUnitEditor.java:1269) at org.eclipse.ui.texteditor.AbstractTextEditor$TextEditorSavable.doSave(AbstractTextEditor.java:6781) at org.eclipse.ui.Saveable.doSave(Saveable.java:212) at org.eclipse.ui.internal.SaveableHelper.doSaveModel(SaveableHelper.java:339)

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest.java