thana
07/09/2020, 9:18 AMComparable
is violated but io cannot spot the violationdiesieben07
07/09/2020, 9:27 AM-
can overflow. For example Int.MIN_VALUE
is clearly smaller than 1
, so compareTo
must return a negative number. Your method overflows and returns Int.MAX_VALUE
, which is positive.thana
07/09/2020, 9:28 AMdiesieben07
07/09/2020, 9:29 AMthana
07/09/2020, 9:32 AMMatteo Mirk
07/09/2020, 9:46 AMoverride fun compareTo(other: Data) = compareValues(value, other.value)
diesieben07
07/09/2020, 9:47 AMThe weird part is that I don’t have that exception in IntelliJ
diesieben07
07/09/2020, 9:47 AMthana
07/09/2020, 9:47 AMTimSort
in the JVm - maybe your runtime does use a different algorithmMatteo Mirk
07/09/2020, 9:49 AMdiesieben07
07/09/2020, 9:50 AMdiesieben07
07/09/2020, 9:50 AMMatteo Mirk
07/09/2020, 9:52 AMdiesieben07
07/09/2020, 9:53 AMMatteo Mirk
07/09/2020, 9:53 AMMatteo Mirk
07/09/2020, 9:55 AMMatteo Mirk
07/09/2020, 9:56 AMstephanmg
07/09/2020, 3:16 PMstephanmg
07/09/2020, 3:17 PMthana
07/09/2020, 4:02 PMstephanmg
07/09/2020, 4:03 PMthana
07/09/2020, 4:13 PMstephanmg
07/09/2020, 4:13 PMstephanmg
07/09/2020, 4:14 PMstephanmg
07/09/2020, 4:16 PMdiesieben07
07/10/2020, 7:30 AMstephanmg
07/10/2020, 9:57 AMstephanmg
07/10/2020, 9:57 AMstephanmg
07/10/2020, 9:57 AMstephanmg
07/10/2020, 9:57 AMstephanmg
07/10/2020, 9:58 AMstephanmg
07/10/2020, 9:58 AM