Inspection for null on left side of comparison if(null = company) ... ?

Wasn't there an inspection to flag conditions like
    if (null == company) {
in contrast to
    if (company == null) {

??

I just made a profile with all inspections enabled and this does not get a warning in 90.144.

5 comments
Comment actions Permalink

I would expect "Contstant on left side of comparison" (from "Code Style" group) to catch this, but it doesn't.
In the inspection, ConstantOnLHSOfComparisonVisitor delegates to PsiUtil.isConstantExpression().
Why is com.intellij.psi.util.PsiUtil not in the community source? And where's 90.144?

-tt

0
Comment actions Permalink

Hello Taras,

I would expect "Contstant on left side of comparison" (from "Code
Style" group) to catch this, but it doesn't.


It should. Please file an issue. :)

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Dmitry,

Any comment on why com.intellij.psi.util.PsiUtil is not part of community source?
When exploring IDEA code I sometimes step into classes that are excluded for no apparent reason.

Taras

0
Comment actions Permalink

Hello Taras,

Any comment on why com.intellij.psi.util.PsiUtil is not part of
community source?


It definitely is. http://git.jetbrains.org/?p=idea/community.git;a=blob_plain;f=java/openapi/src/com/intellij/psi/util/PsiUtil.java;hb=HEAD

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.