Statement Bodies Missing Braces

Background

While java allows block statements without braces, the chance of making mistakes increases if braces are not used. For example when adding a new statement inside such a block, the fact that braces are missing is easily overlooked.
This codecheck generates a warning/error when these braces are omitted.

Since 0.6

Example

Bad code:

Good code:



if (positiveInteger < 0)
    hangMe();
if (positiveInteger < 0) {
    hangMe();
}


Available quick fixes

The quick fix for this code check adds braces around the selected block statement.