| Summary: | [ast rewrite] ListRewrite#createTargetNode(..) should use type of last node for placeholder | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> |
| Component: | Core | Assignee: | David Audel <david_audel> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | dirk_baeumer |
| Version: | 3.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | stalebug | ||
*** Bug 108707 has been marked as a duplicate of this bug. *** I guess we need a special ListRewrite for modifier lists. Here's ChangeSignatureTests#testAll63() from bug 112462: class A { void m() { } } class Sub extends A { @Override void m() { } } class Sub2 extends A { @Override @Deprecated void m() { } } Change method signature of A#m() to protected gives: class A { protected void m() { } } class Sub extends A { @Override protected void m() { } } class Sub2 extends A { @Override @Deprecated protected void m() { } } There should never be a line break after the keyword modifiers, and the linebreak between annotations should be controlled by the code formatter option. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
I20050803-0800 ListRewrite#createTargetNode(..) should use the type of the last node for the created placeholder. Currently, it uses: ASTNode placeholder= nodeStore.newPlaceholderNode(first.getNodeType()); but it should use: ASTNode placeholder= nodeStore.newPlaceholderNode(last.getNodeType()); This would lead to better formatting of the whitespace after the copied node range when it is inserted somewhere, e.g.: class A { void method() { @SuppressWarnings("all") final double a= 0, b= 1, c= 2; //convert b to field } } Currently, if you convert b to a field, the result is this (note the line break between 'final' and 'double c= 2'): class A { private double b; void method() { @SuppressWarnings("all") final double a= 0; b = 1; @SuppressWarnings("all") final double c= 2; //convert b to field } } When the last node is used, the result is this: class A { private double b; void method() { @SuppressWarnings("all") final double a= 0; b = 1; @SuppressWarnings("all") final double c= 2; //convert b to field } } There's exactly one test in the jdt.ui test suite that is affected by this change: PromoteTempToFieldTests#testMultiVariableDeclFragment01().