Incompatible bitwise mask operation
Reports bitwise mask expressions which are guaranteed to evaluate to true
or false
.
The inspection checks the expressions of the form (var & constant1) == constant2
or (var | constant1) == constant2
, where constant1
and constant2
are incompatible bitmask constants.
Example:
// Incompatible mask: as the mask ends in 00,
// the result could be 0x1200 but not 0x1234
if ((mask & 0xFF00) == 0x1234) {...}
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023