Disabling an IntelliJ inspection : warning "if (a == false) change to if (!a)". I see no link or code to jump to it's configuration

Viewed 211

On a Java line code I've wrote :

if (row.isNullAt(row.fieldIndex(codeCompetence)) == false)

IntelliJ warns :
row.isNullAt(row.fieldIndex(codeCompetence)) == false
can be simplified to
!row.isNullAt(row.fieldIndex(codeCompetence))

which is absolutely true. Except that I don't want to.
For me, not having a good sight, a little ! on the left of an expression is far less visible than an
== false on the middle, at the same place you usually find ==, >=, <, !=, .equals,
and most of others comparisons.


On the Problems Windows, I don't see a code or a link to jump directly to the configuration the inspection leading to the apparition of the warning :
'row.isNullAt(row.fieldIndex(codeCompetence)) == false' can be simplified to '!row.isNullAt(row.fieldIndex(codeCompetence))'

And I still haven't found it among all the inspections available on IntelliJ.

My questions

  1. Where do I click to jump directly on the definition of any warning / error message I see on my Problems windows ?
    The context menu coming when right-clicking with the mouse doesn't offer this choice.

  2. If the feature isn't available, do you know what is the inspection I should disable ?

2 Answers

The inspection is called "Pointless Boolean Expressions". Here is its description:

Reports pointless or pointlessly complicated boolean expressions. Such expressions include anding with true, oring with false, equality comparison with a boolean literal, or negation of a boolean literal. Such expressions may be the result of automated refactorings not completely followed through to completion, and in any case are unlikely to be what the developer intended to do.

You can disable it by pressing on the little arrow:

enter image description here

Or by searching for words in its description in the inspections list.

I would prefer the shorter variant, everyone should see the „!“ when he is looking at the Statement, but this could help you Disable IntelliJ Warnings

Related