Constant conditions inspection became less paranoid in Idea 12 - is it good?


For ages is was so that such code:

if(a.b != null)

triggered inspection. It used to say "potential NPE", and it was right, beacause a.b could be changed in another thread, or modified be some random code that we executed between these lines.
Naturally, many people were bothered, because even in trivial single-thread code it forced them to introduce safe variables, but we lived with it.

In Idea 12, all these alerts disappeared. It doesnt matter whether you call some methods or your code is not thread-safe, inspection says nothing. And there is no option to enable the old-school behavior.

Was it intended this way? :)


Please sign in to leave a comment.