Remove Comparable interface from ScoreAccessor (#35519)

The way ScoreAccessor implements `compareTo()` is problematic because it doesn't
completely follow the Comparable contract, specificaly symmetry (if x is a
ScoreAccessor and y any Number then x.comparTo(y) works, but y.compareTo(x)
generally does not even compile). Fortunately we don't seem to use the fact that
ScoreAccessor is a Comparable anywhere, so we can simply remove it.
This commit is contained in:
Christoph Büscher 2018-11-14 05:58:05 +01:00 committed by GitHub
parent 603d1a470f
commit d8b1c23e1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 6 deletions

View File

@ -30,7 +30,7 @@ import java.io.IOException;
* The provided {@link DocLookup} is used to retrieve the score
* for the current document.
*/
public final class ScoreAccessor extends Number implements Comparable<Number> {
public final class ScoreAccessor extends Number {
Scorable scorer;
@ -65,9 +65,4 @@ public final class ScoreAccessor extends Number implements Comparable<Number> {
public double doubleValue() {
return score();
}
@Override
public int compareTo(Number o) {
return Float.compare(this.score(), o.floatValue());
}
}