Summary: | IAE in ASTNode.setSourceRange while editing a class | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Frederic Fusier <frederic_fusier> | ||||||||
Component: | Core | Assignee: | David Audel <david_audel> | ||||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||||
Severity: | major | ||||||||||
Priority: | P3 | CC: | curtis.windatt.public, Ed.Merks, jerome_lanneluc, Olivier_Thomann, philippe_mulet | ||||||||
Version: | 3.3 | ||||||||||
Target Milestone: | 3.3.1 | ||||||||||
Hardware: | PC | ||||||||||
OS: | Windows XP | ||||||||||
Whiteboard: | |||||||||||
Bug Depends on: | 203579 | ||||||||||
Bug Blocks: | |||||||||||
Attachments: |
|
Description
Frederic Fusier
2007-08-12 06:14:14 EDT
Increase severity to 'major' as the reconciling stops to work in the edited file which is definitely annoying. I was obliged to use the debugger to find the origin of the problem and fix the syntax error to have the reconciler back working, so I guess that standard user would never get it... *** Bug 200080 has been marked as a duplicate of this bug. *** Created attachment 76210 [details]
Woraround and regression test
Workaround and test released in HEAD. David, please check the workaround and make the necessary modifications (or rewrite the fix if needed). *** Bug 201285 has been marked as a duplicate of this bug. *** +1 for 3.3.1 The workaround works but we can do a better simple fix. The bug is caused by the statements recovery. The syntax error is: Syntax error on token ",", VariableDeclarator expected after this token. Then a fake Identifier is added by recovery as a VariableDeclarator and the 'sourceEnd' of the corresponding ast node is equals to his 'sourceStart - 1'. ASTConverter#convertToVariableDeclarationFragment use this 'sourceEnd' to find the position of the following comma or semicolon but in this case the previous comma is found instead and this cause the IllegalArgumentException. For 3.3.1, to do the smallest and less dangerous fix we should use the 'sourceStart' instead of the the 'sourceEnd' when the variable name is a fake token. For 3.4, we could do a more general fix because there is some other inconsistency in convertToVariableDeclarationFragment() behavior that require a bigger fix. Created attachment 77374 [details]
Proposed patch for 3.3.1
Released for 3.3.1. Test added ASTConverterTest2#test0608() -> test0610() Verified for 3.3.1 using M20070831-2000. Reopen to fix the bug in 3.4 The fix for the bug 203579 will be probably to remove whitespace from the fragment. So the call to retrievePositionBeforeNextCommaOrSemiColon() will be removed and this bug will disappear. I will remove the released workaround from 3.4 once the bug 203579 will be fixed Created attachment 78886 [details]
Proposed fix + regression test
David, Please review last patch. Thanks. The patch for 3.4 is good. It remove the useless workaround. Released for 3.4M3. Test updated ASTConverterTest2#test0608() Verified for 3.4M3 using I20071029-0019. Resetting target to 3.3.1 as this is the lowest target where the fix can be found. |