Community
Participate
Working Groups
20030604 1. Create a project with the JUnit source 2. In 'ResultPrinter' remove the closing bracket of the constructor. Note: The outliner still shows to structure of the CU 3. Select the constructor in the outliner 4. press delete: This removes almost the whole CU Either the AST get's as good as the reconciler in recovering or we could update the AST positions with the JAVAElement position when we detect errors in the AST
The AST contains all elements even the bracket is missing! Unfortunatly the length of the constructor node is too large. Moving to JCore to ask if it would be possible to get more valid ranges (e.g. like the Java elements). Currently the ranges are overlapping.
Could you please provide the exact test case? What I tried works fine.
added ASTRewritingMethodDeclTest.testBUG_38447
I looked at your test case. You cannot expect the comments to be part of the foo1 declaration. If the last comment is a javadoc comment instead of a block comment, then it will be included in the foo1 declaration. Otherwise these comments are not attached to a particular node. I fixed the code to stop the declaration of foo on the opening brace '{'. In case of a syntax error, it is much more difficult to get the right positions. I don't remember that we ever garantee any "reliable" positions in case of a syntax error.
Don't care about the comment. The problem reported is that the range of foo is covering the other methods. If the range now ends on { that's great.
Fixed and released in HEAD contents. Regression tests added.
Verified.