error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

Incorrect IdentityBinaryExpression message?

Open axkr opened this issue 3 years ago • 0 comments

errorprone version 2.15.0

For binary logical operations with multiple decrements on an array index like this

if (((sieveArray[x--] | sieveArray[x--] | sieveArray[x--] | sieveArray[x--]) & 0x80) != 0) {
   ...

   ...
}

errorprone prints a IdentityBinaryExpression message:

[IdentityBinaryExpression] A binary expression where both operands are the same is usually incorrect; the value of this expression is equivalent to `sieveBlock[x--]`.

https://errorprone.info/bugpattern/IdentityBinaryExpression

The message is propably wrong?

axkr avatar Aug 17 '22 15:08 axkr