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.
Formatting of an if-statement like this does not work correctly: if (condition_1) { // Comment-1 doSomething(1); } else { // Comment-2 if (condition_2) { doSomething(2); } else { doSomething(3); } } Is formatted as: if (condition_1) { // Comment-1 doSomething(1); } else // Comment-2 if (condition_2) { doSomething(2); } else { doSomething(3); } As "Comment-2" is behind the "else", it doesn't look like a comment for the following if-statement, but as a comment for the else-statement. Instead, formatting should not change anything in this special case (the block following the else contains a comment in the very first line). However, I really like building a switch-like if-else structure, when there is no comment in the first line of the block following else, like this: if (condition_1) { // Comment-1 doSomething(1); } else { if (condition_2) { doSomething(2); } else { doSomething(3); } } being formatted to: if (condition_1) { // Comment-1 doSomething(1); } else if (condition_2) { doSomething(2); } else { doSomething(3); } as this does not change source code semantics.