Re: Inspection for null on left side of comparison if(null=company)... ?
Hello Taras,
I stand corrected - I configured an IDEA SDK for the IDEA project by
mistake.
As for the inspection in questions,
com.intellij.psi.util.IsConstantExpressionVisitor#visitLiteralExpressi
on() seem to special-case null. Is there some language detail that I
forgot?
We looked at that code and tried to understand why it does that, but couldn't
figure it out right away, and the checkin comment for the change introducing
that special case is empty. :)
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Please sign in to leave a comment.
Hello Taras,
We looked at that code and tried to understand why it does that, but couldn't
figure it out right away, and the checkin comment for the change introducing
that special case is empty. :)
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Hello Taras,
AFAIK, null is not constant according to JLS. For example that's also why null can't be used as
default value in annotations.
Sascha
Hello Sascha,
Indeed, Bas reminded me of this distinction in the comments for http://youtrack.jetbrains.net/issue/IDEADEV-41208
I think that in the context of this inspection it can be treated as a constant though.
Taras