I was working on a change in some old system. To guarantee I was building on the correct source I ran a comparison between class files in an existing jar and those in the new jar. I decompiled some class which has differences in binary form, and below was found.
Java source decompiled from old class and the source code of the new class file that I built on are the same as below:
if(user != null){
...
if(user !=null){
...
}
}
Java source decompiled from the new class file: the inner null checking does not exist. Note that there is no change to 'user' between the two ifs:
if(user != null){
...
...
...
...
}
So, I want to know if the null checking was removed by the Java compiler as an optimization? If yes, in what cases (i.e., javac version, compile options) will it happen?