File: BadComparable.md

package info (click to toggle)
error-prone-java 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 15,076 kB
  • sloc: java: 171,398; xml: 1,459; sh: 34; makefile: 7
file content (4 lines) | stat: -rw-r--r-- 275 bytes parent folder | download | duplicates (2)
1
2
3
4
A narrowing integral conversion can cause a sign flip, since it simply discards
all but the n lowest order bits, where n is the number of bits used to represent
the target type (JLS 5.1.3). In a compare or compareTo method, this can cause
incorrect and unstable sort orders.