Comparison to value that is out of range for the compared type


The problem

This checker looks for comparisons to values that are too high or too low for the compared type. For example, bytes may have a value in the range -128 to 127. Comparing a byte for equality with a value outside that range will always evaluate to false and usually indicates an error in the code.


Suppress false positives by adding the suppression annotation @SuppressWarnings("ComparisonOutOfRange") to the enclosing element.