Back to Intellij Community

BooleanVariableAlwaysNegated

java/java-impl/resources/inspectionDescriptions/BooleanVariableAlwaysNegated.html

2025.3-rc-2224 B
Original Source

Reports boolean variables or fields which are always negated when their value is used.

Example:

void m() {
        boolean b = true; //boolean variable 'b' is always inverted
        System.out.println(!b);
      }