0

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

Hi,

For ages is was so that such code:

if(a.b != null)
  a.b.foo();

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? :)

17 comments

Please sign in to leave a comment.