Community
Participate
Working Groups
Version: 3.4.0 Build id: I20080530-1730 Windows or Linux java.version=1.6.0_03 See the test case below: public class Test { public static void main(String[] args) { Boolean foo = null; // #1 System.out.println( foo ); // #2 } } If you put a conditional breakpoint on the line marked as #2 with the following expression: foo != null You will get an error dialog saying a NullPointerException was encountered when invoking booleanValue(), which is bogus. Trying to evaluate the same expression via Display view will result in the same NPE. This seems to happen for any of the primitive wrappers. Workaround is to use the following expression instead: !(foo == null)
I was hoping this would be an easy fix, given that it is easily reproducible. Has anyone looked into this? Any plans of addressing it for 3.5?
No-one has looked into this yet, as our instruction compiler code is very touchy :) Contributions are always welcome.
*** Bug 262019 has been marked as a duplicate of this bug. ***
Looks like the evaluation is attempting to unbox expressions for primitive wrappers when using the != operator (which results in an NPE since the object is null and can't be unboxed).
Fixed in ASTInstructionCompiler.visit(InfixExpression). The fix is to only unbox operands for == and != operators when at least one operand is primitive (otherwise, just compare the objects).
Fixed.
looks good