Where is an inspection to trigger on "null != foo"?
Which of the eleventy-hundred-sixty-five inspections can trigger if null is on the left side of a comparison?
"Constant on left side of comparison" does not trigger.
Please sign in to leave a comment.
Hello Stephen,
Stephen Friedrich wrote:
The Structural Search Inspection:-)
Technically null is not a compile-time constant, therefore this
inspection does not trigger on it. I suppose I could add an option to
the inspection to check null too, if you have a good enough reason.
Please submit a JIRA issue.
Bas
Why do you need such an inspection?
It is very useful to put the constants like null to the left side.
i always put constants on the right side. probably for the same reason as yours, just the other way round (i think your way of thinking is weird^^ - i want to know which variable is checked first, and then i want to know what condition it has to fulfill. let's say i have 200 if else if else if, having the same constant on the left side gives me a lot less information than having a variable on the left side.)
i'll vote for that jira request if it includes the text "this should work for the opposite way as well" somewhere.
Message was edited by:
HamsterofDeath