| Summary: | [formatter] Inserts wrong line breaks on ASTRewrite (Extract Constant, Extract Local Variable) | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> | ||||
| Component: | Core | Assignee: | Markus Keller <markus.kell.r> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | manoj.palat, markus.kell.r, mateusz.matela | ||||
| Version: | 4.5 | ||||||
| Target Milestone: | 4.5 M6 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | 303519 | ||||||
| Bug Blocks: | |||||||
| Attachments: |
|
||||||
The problem is that the the formatter now appends a line break when formatting CodeFormatter.K_EXPRESSION, K_STATEMENTS, and K_CLASS_BODY_DECLARATIONS kinds when "insert_new_line_at_end_of_file_if_missing" is set to "insert". This bug makes refactorings unusable when that option is enabled. I'll fix it for tomorrow's I-build. Verified in I20150217-0800. |
Created attachment 250823 [details] FormatterTest project With the formatter settings in the attached project, apply Extract Constant or Extract Local Variable to the integer literals '1' here: public class MyTest { int i= 1; { if (hashCode() == 1) { } } } Result has too many line breaks: public class MyTest { private static final int _1= 1; int i= _1 ; { int j= 1; if (hashCode() == j ) { } } }