Community
Participate
Working Groups
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"
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 ***