File: BadComparable.md

package info (click to toggle)
error-prone-java 2.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 23,204 kB
  • sloc: java: 222,992; xml: 1,319; sh: 25; 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.