| Summary: | TextEdit computed incorrectly for inserting annotation before package declaration | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Paul Fullbright <paul.fullbright> | ||||
| Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | brian.vosburgh, daniel_megert, jarthana, karenfbutzke, neil.hauge, Olivier_Thomann, satyam.kandula | ||||
| Version: | 3.6.1 | Flags: | daniel_megert:
pmc_approved+
|
||||
| Target Milestone: | 3.6.2 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows Vista | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Paul Fullbright
I'm bumping the severity of this. It prevents our ability to add annotations programmaticaly to package declarations, as the package declaration is unparseable afterward. Could you please provide a small test case that shows the problem so I can see how you are using the ASTRewrite? Thanks. Ok, I reproduced the issue. Investigating. Created attachment 181528 [details]
Proposed fix + regression tests
Released in HEAD. Added regression tests in: org.eclipse.jdt.core.tests.rewrite.modifying.ASTRewritingModifyingInsertTest#test0016 org.eclipse.jdt.core.tests.rewrite.describing.ASTRewritingPackageDeclTest Daniel, I think this should be backported to 3.6.2. Fantastic! Thanks for the quick turnaround! Could you please check that the fix is working for you ? Paul, please confirm that the fix works for you. Olivier, shouldn't we add an else branch where we call rewriteModifiers(...)? At least the other *Declaration visit methods do so. (In reply to comment #9) > Olivier, shouldn't we add an else branch where we call rewriteModifiers(...)? > At least the other *Declaration visit methods do so. I don't think so as the other calls also needs to handle the old getModifiers() call. Package declaration's annotations are only available in JLS3 so there is no need to try to handle the call if the JLS level < JLS3. (In reply to comment #8) > Could you please check that the fix is working for you ? Yes it is. In fact, there is also a return/new line after the new annotation, which is a very nice plus. Thanks. > Package declaration's annotations are only available in JLS3 so there is no
> need to try to handle the call if the JLS level < JLS3.
True.
+1 for 3.6.2.
Verified for 3.7M3 using build I20101025-0901 Not marking it verified as this has to be fixed for 3.6.2 Reopening to target 3.6.2. (In reply to comment #11) > Yes it is. In fact, there is also a return/new line after the new annotation, > which is a very nice plus. Thanks. It should respect the formatter settings which is to add a new line by default. Released for 3.6.2. Same patch was applied on 3.6 maintenance stream. Verified for 3.6.2 using build M20110119-0834 |