A redundant operation is one that does not have any effect, such as

  • an assignment of a variable to itself
  • use of an expression that will be evaluated to a constant such as a/a
  • use of an expression that can be reduced to one operand such as a & a.

Even if this is not an error on its own, it may indicate a larger error in the code. A REDUN.OP error indicates there is a redundant operation such as a/a, a&a, a | a, a <a.

Example 1

      public int test() {
         int var = 1;
         if (var < var) {
             return 1;
         return 0;

REDUN.OP is reported for line 11: Suspicious operation with 'var' on both sides