Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] MalformedTreeException when rewriting AST

Hello,

while testing my refactorings I happen to get a MalformedTreeException with message "Overlapping text edits" while collecting the changes from the ASTRewrite instances. Even with minimalistic test cases I find it pretty hard to identify the exact cause for this.
I'll try to describe one case in which the exception occurs:
I have a cpp file with one method definition. I want to remove the definition and afterwards add a different one. These are distinct operations so they can not be expressed as a single 'replace' operation on the AST.


My commit (https://git.eclipse.org/r/#/c/22177/) contains a test case for the described scenario (file PullUpRefactoringTest, line 340). This problem might be very specific to my implementation but maybe someone has some hints or best practice advice to avoid this error?

Regards,
Simon


Back to the top