| Summary: | ASTRewrite inserts bad line break when changing 'else' statement with comment to block | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | Mateusz Matela <mateusz.matela> |
| Severity: | normal | ||
| Priority: | P3 | CC: | dawnstar, jarthana, mateusz.matela |
| Version: | 4.3 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | stalebug | ||
I can also see it in ast rewrite (I call method CompilatioUnit.rewrite(...) ).
Then I try to force this but it doesn't work:
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, JavaCore.DO_NOT_INSERT); //It's default not to insert
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. Mateusz, do you know if this is still an issue or that we can close this now? Yes, still works as described here. The formatter returns correct results, but they don't seem to be used properly. |
- have code: void foo(boolean b) { if (b) { System.out.println("a"); } else System.out.println("b"); // problem on "Change 'else' to block" } - apply quick assist "Change 'else' to block" - result: if (b) { System.out.println("a"); } else { System.out.println("b"); // problem on "change 'else' to block" } => expected: "} else" should stay like it was (on the original line).