An inspection for this "Probably bug?

This code compiles, thanks to autoboxing, but is most probably a bug:



cb.setSelected(o==null?null:o.isOK) ;



Introduce Variable, and it's now very clear:

Boolean b = o == null ? null : o.isOK;
cb.setSelected(b) ;


Dave, should I post it?

Alain

2 comments
Comment actions Permalink

Post it, but it more properly belongs in JetBrains court than mine, since they've got all the nullity checking stuff. Doing it right will take their dataflow engine. Call it "Auto-unboxing may cause NPE", or something like that.

--Dave Griffith

0
Comment actions Permalink

Done:
"new "Probably Bug" inspection: Auto-unboxing may cause NPE"
http://www.jetbrains.net/jira/browse/IDEA-3382


Alain


Dave Griffith wrote:

>Post it, but it more properly belongs in JetBrains court than mine,
>

0

Please sign in to leave a comment.