google / google/error-prone

Incorrect IdentityBinaryExpression message?

Open
#3,398 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

errorprone version 2.15.0

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

```java
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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.