The analyzer has detected an expression that can be reduced. Such redundancy may be a sign of a logical error.
Consider this example:
boolean firstCond, secondCond, thirdCond;
....
if (firstCond || (firstCond && thirdCond))
....
This expression is redundant. If 'firstCond == true', the condition will always be true regardless of what value the 'thirdCond' variable refers to; and if 'firstCond == false', the condition will always be false – again, irrespective of the 'thirdCond' variable. Thus, the expression 'firstCond || (firstCond && thirdCond)' can be simplified:
if (firstCond)
Perhaps the programmer made a mistake and wrote a wrong variable in the second subexpression. Then the correct version of this code should look like this:
if (firstCond || (secondCond && thirdCond))
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders:
Take
a chance!