This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 148736 [details] Java source file 1. Open attached source file. 2. Put cursor on keyword "else" on line 8. 3. Invoke the tool tip refactoring on line 8, "Join consecutive ifs into if-else" Results: ---------- package suggestions; public class JoinConsecutiveIfsIntoIfElse { public void method(boolean cond1, boolean cond2) { if(cond1) { } else //Hint: Join nested if into the enclosing if if(cond2) { System.out.println("ok"); } else { System.out.println("ko"); } // System.out.println(""); if(cond1) { } else { //NoHint: Join nested if into the enclosing if if(cond2) { System.out.println("ok"); } System.out.println(""); } } } ---------- Expected: ---------- package suggestions; public class JoinConsecutiveIfsIntoIfElse { public void method(boolean cond1, boolean cond2) { if(cond1) { } else if(cond2) { System.out.println("ok"); } else { System.out.println("ko"); } if(cond1) { } else { //NoHint: Join nested if into the enclosing if if(cond2) { System.out.println("ok"); } System.out.println(""); } } } -----
Created attachment 148737 [details] logfile
The result is correct - the wrapping braces in else part are removed, the only changes to previous version is that the line comments are preserved, so the else if is not merged to one line.