Since when does if / else require braces?

advertisements

I just started a new project in the latest Netbeans, and I noticed it has started giving me code advisories for code like this:

    if (a == null) x = 0;
    else x = 1;

it says

If-Else Statements MUST use Braces

it wants to "fix" it to this:

    if (a == null) {
        x = 0;
    }
    else {
        x = 1;
    }

which I don't want at all. I am particular about this and it makes the code look unnecessarily cluttered. I have tens of thousands of lines of code that don't use (and apparently don't need) the extra braces. Assuming Netbeans has it right, when did this requirement happen and what is driving it?

P.S. I know I can turn off those messages.

UPDATE TO QUESTION:

It might not have been obvious the way that I wrote this, but based on @corsiKa's comments below maybe I should clarify. I really didn't want a discussion of whether the curly braces were or were not desirable. I wanted to know if they have become necessary.

The boys and girls that write and produce Netbeans are usually pretty well plugged in to the community and what direction Java is taking or what is contemplated. So I considered it possible that when they were using the advisory mechanism to give us a heads up that the java grammar is going to change and the code practice that I was using was going to become deprecated at some point.

From saber_raider's answer below it looks like the answer is no. It appears that the Netbeans advisory was overstated with the word MUST as Mystical suggested.


This is definitely not a syntactical requirement of java but just a feature of netbeans. Feel free to turn it off if you are sure what you are doing...