While implementing the fix for bug 326950, the compiler's bytecode generation changed for code that is analysed to be dead because of compiler's null analysis. The compiler no longer skips generating bytecode for code that is found dead as a result of a redundant null check.
For example:
String s = null ; if (s == null) { System.out.println("SUCCESS"); } else { System.out.println("Dead code, but don't skip me"); }
In the above code, the compiler will generate bytecode corresponding to the statement
System.out.println("Dead code, but don't skip me")
even though the else branch
can never be reached since s
is always null. In 3.6, the compiler would always
skip generating bytecode for dead code.