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.
Product Version: NetBeans IDE Dev (Build 201505020001) Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02 Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b14 System: Windows 7 version 6.1 running on amd64; UTF-8; pl_PL (nb) Source format automatically removes braces from "else" statement with "if-else" inside. I'm aware that it doesn't change execution flow, but anyway it shouldn't happen. Testcase: public void demo(boolean a, boolean b) { if (a) { if (b) { System.out.println("a AND b"); } else { System.out.println("a AND NOT b"); } } else { // a is false if (b) { System.out.println("NOT a AND b"); } else { System.out.println("NOT a AND NOT b"); } } } After format: public void demo(boolean a, boolean b) { if (a) { if (b) { System.out.println("a AND b"); } else { System.out.println("a AND NOT b"); } } else // a is false if (b) { System.out.println("NOT a AND b"); } else { System.out.println("NOT a AND NOT b"); } } The code after the format is harder to read and it's not fit our coding style.
(In reply to cezariusz from comment #0) > it's not fit our coding style. I mean it doesn't follow our coding style.
This behavior can be customized in Options -> Editor -> Formatting -> Braces -> Special If-else treatment
(In reply to Jiri Prox from comment #2) > This behavior can be customized in Options -> Editor -> Formatting -> Braces > -> Special If-else treatment If you deselect "Special If-else treatment" braces will not removed, but "else if" will be break into two lines. This behaviour did not happen in past verions of NB, like v7: braces were never removed.
Probably caused by http://hg.netbeans.org/jet-main/rev/4632127cda3e