This post was brought to you by this PMD rule.
Transcription
Why do we have this stupid code analyzer rule enabled anyway? Nobody writes code like this…
After telling them the lore why it’s there:
You have seen such things before?
11 Times, as a matter of fact
Well, it also avoids running instantiation code, which could be doing all kinds of things. In theory, it could have a side-effect which modifies some of your application state or issues a log statement or whatever.
Even if it doesn’t do anything wild right now, someone could change that in the future, so avoiding running such code when it’s not needed is generally a good idea.