Closed phase closed 3 years ago
Can you add a test for a situation that was failing before and post how the "conflict" looks like (is it some exception)?
Added a test case with a failing static import.
Here's the stacktrace:
Caused by: org.eclipse.text.edits.MalformedTreeException: Overlapping text edits
at org.eclipse.text.edits.TextEdit$InsertionComparator.compare(TextEdit.java:126)
at org.eclipse.text.edits.TextEdit$InsertionComparator.compare(TextEdit.java:1)
at java.util.Collections.indexedBinarySearch(Collections.java:334)
at java.util.Collections.binarySearch(Collections.java:322)
at org.eclipse.text.edits.TextEdit.computeInsertionIndex(TextEdit.java:799)
at org.eclipse.text.edits.TextEdit.internalAdd(TextEdit.java:784)
at org.eclipse.text.edits.TextEdit.addChild(TextEdit.java:340)
at org.cadixdev.mercury.RewriteContext.combineEdit(RewriteContext.java:105)
at org.cadixdev.mercury.RewriteContext.rewrite(RewriteContext.java:88)
at org.cadixdev.mercury.RewriteContext.process(RewriteContext.java:131)
at org.cadixdev.mercury.Mercury.accept(Mercury.java:222)
This takes all of the children in the
MutliTextEdit
we want to merge and makes them children of theMutliTextEdit
being merged into. Conflicts were occurring when one MTE's edit range was overlapping with the others edit range.I ran this over multiple codebases and this change didn't affect anything other than the static imports that were failing.