Project: JDT
Bug 83041 Error inlining with overlapping edits [refactoring]
Reported: 2005-01-17 17:45:19 | Status: resolved fixed

Build: I20050112 Test case: public class A { public static String foo(String s) { return s; } } class C { void bar() { System.out.println(A.foo(A.foo("hello"))); } } Run Refactor > Inline on A.foo(). An error occurs: org.eclipse.text.edits.MalformedTreeException: Overlapping text edits at org.eclipse.text.edits.TextEdit$InsertionComparator.compare(TextEdit.java:122) at java.util.Collections.indexedBinarySearch(Collections.java:327) at java.util.Collections.binarySearch(Collections.java:315) at org.eclipse.text.edits.TextEdit.computeInsertionIndex(TextEdit.java:759) at org.eclipse.text.edits.TextEdit.internalAdd(TextEdit.java:746) at org.eclipse.text.edits.TextEdit.addChild(TextEdit.java:336) at org.eclipse.jdt.internal.corext.refactoring.code.InlineMethodRefactoring.checkFinalConditions(InlineMethodRefactoring.java:232) at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:84) at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:114) at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:188) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1703) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:86) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:111)

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/simple_in/TestNestedCalls.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/simple_in/TestTwoCalls.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/simple_out/TestNestedCalls.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/simple_out/TestTwoCalls.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/InlineMethodTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/CallInliner.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineMethodRefactoring.java