FULL PRODUCT VERSION :
"1.5.0" build 1.5.0-b64
ADDITIONAL OS VERSION INFORMATION :
WindowsXP sp2
A DESCRIPTION OF THE PROBLEM :
Auto-boxing in ternary operator compiles fine but has an execution failure of NullPointerException when it should execute properly.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the code supplied.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No exception
ACTUAL -
An exception
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.NullPointerException
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class Test {
public static void main(String[] args) {
// Java bug!
String a = null;
Integer j = 8;
Integer k = null;
Integer i = (a != null)
? 5 // okay with j, non-null, but fails on k below when this has Auto-boxing
: k;
}
}
---------- END SOURCE ----------
###@###.### 2004-12-22 01:42:41 GMT
###@###.### 2005-1-03 19:57:36 GMT