Rule that checks unnecessary boolean expressions, including ANDing (&&) or ORing (||) with
true
, false
, null
, or a Map/List/String/Number literal.
This rule also checks for negation (!) of true
, false
,
null
, or a Map/List/String/Number literal.
Examples include:
def result = value && true
if (false || value) { .. }
return value && Boolean.FALSE
result = value && "abc"
result = null && value
result = value && 123
result = 678.123 || true
result = value && [x, y]
def result = [a:123] && value
result = !true
result = !false
result = !Boolean.TRUE
result = !null
result = !"abc"
result = ![a:123]
result = ![a,b]
Type | Name and description |
---|---|
Class |
astVisitorClass |
String |
name |
int |
priority |