| Summary: | [quick assist][clean up] Save action "Use blocks in if/while..." deletes comments before "else if" | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Werner Piel <werner-e1> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | deepakazad |
| Version: | 3.8 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Fix to go in ControlStatementsFix.AddBlockOperation.rewriteAST(...) Also a problem with the corresponding quick assists - 'Change if statement to block', 'Change if-else statements to blocks' etc. Fix for quick assists to go in QuickAssistProcessor.getAddBlockProposals(...). *** This bug has been marked as a duplicate of bug 378139 *** |
Build Identifier: Version: Indigo Service Release 1 Build id: 20110916-0149 When using the option "Always" in "Use blocks in if/while/for/do statements" as an additional Save Action, comments (and empty lines) get deleted when if-statement has a single expression without a block followed by an if-else-statement. Example: Before save: public void test() { if ("x".equals("x")) new Integer("1"); // 1 /* * 2 * 3 * 4 */ else if ("y".equals("y")) new Integer("1"); } After save: public void test() { if ("x".equals("x")) { new Integer("1"); } else if ("y".equals("y")) { new Integer("1"); } } Reproducible: Always Steps to Reproduce: 1. Display properties dialog for project 2. Check "Additional actions" checkbox in "Java Editor/Save Actions" dialog 3. Press "Configure..." button (shows the "Additional Save Actions" dialog 4. Check "Use blocks in if/while/for/do statements" checkbox and select the first radiobutton "Always". 5. Close the property dialogs 6. Save the java-sourcefile with the example as described in "Details"