Community
Participate
Working Groups
Using M3, the following bug has been reported on EC: Javac and eclipse compiler don't behave the same on this code: public class NullOuvert { public static final boolean VIER_BUBEN = false; public static final String SPIEL = VIER_BUBEN ? "Grand Hand" : null; public static void main(String[] args) { System.out.println(SPIEL == null); System.out.println(SPIEL.equals(null)); System.out.println(SPIEL); } } When running Eclipse compiler bytecodes: false false null When running javac bytecodes: true Exception in thread "main" java.lang.NullPointerException at NullOuvert.main(NullOuvert.java:6) This is a serious problem. A workaround seems to be to cast the null literal in a String. Then they behave the same.
The casting work-around only turns off the constant inlining (would have achieved the same effect by removing the final flag on VIER_BUBEN). Fixed constant code generation to disable inlining String value of null constant (case where target type is String). Target Object type was already doing the same.
Took out null constants completely, these are not legite anyway. Fixed
Verified.