blob: 245c8da59acbb5370d525a07e2e9a36217bc82c1 [file] [log] [blame]
<html>
<body>
Reports subtraction in
<b>compareTo()</b> methods and methods implementing <b>java.util.Comparator.compare()</b>. While it is a common idiom to
use the results of integer subtraction as the result of a <b>compareTo()</b>
method, this construct may cause subtle and difficult bugs in cases of integer overflow.
Comparing the integer values directly and returning -1, 0, or 1 is better practice in almost
all cases.
<!-- tooltip end -->
<p>
</body>
</html>