Why is this an issue?
Redundant Boolean literals should be removed from expressions to improve readability.
Noncompliant code example
if (booleanMethod() || false) { /* ... */ }
doSomething(!false)
booleanVariable = if (booleanMethod()) true else false
booleanVariable = if (booleanMethod()) true else exp
booleanVariable = if (booleanMethod()) false else exp
booleanVariable = if (booleanMethod()) exp else true
booleanVariable = if (booleanMethod()) exp else false
Compliant solution
if (booleanMethod()) { /* ... */ }
doSomething(true)
booleanVariable = booleanMethod()
booleanVariable = booleanMethod() || exp
booleanVariable = !booleanMethod() && exp
booleanVariable = !booleanMethod() || exp
booleanVariable = booleanMethod() && exp