Community
Participate
Working Groups
Compiling private static final Object X[] = new Object[]{null,null} yields much longer byte code in Eclipse 2.1.1 (200305071103) than in 2.0.2 (200211071448). The compiler generates unnecessary stores for the null values.
The reason is that we no longer consider null has a constant. This case could still be optimized. I will investigate.
Created attachment 4825 [details] Fix proposal Philippe, I attached a patch that optimizes this case. We now generate the same bytecodes than jikes. javac 1.4.1_02 or 1.4.2b21 still generate the whole array initializer. Let me know if you want me to release it.
Please release this patch. Indeed, I forgot about this codegen optimization when removing null constant expressions.
Olivier, also backport it to 2.1 maintenance stream.
Fixed and released in HEAD stream.
Backported to 2.1 maintenance stream.
Regression test added.
Verified.