Open scabug opened 11 years ago
Imported From: https://issues.scala-lang.org/browse/SI-7017?orig=1 Reporter: @soc Affected Versions: 2.11.0-M1
@Ichoran said: Want me to take this one, Simon? Finding existing usages is one of my primary tasks these days. I'm not sure anything can be done, but when I've got the tooling in place at least I can assess.
@soc said:
I think we should have a look whether we can alias Ordered to Comparable on the JVM, and add some warning, and let the compiler move the implementation from compare
to compareTo
in people's code.
A few years ago,
Ordered
was made a sub-class ofComparable
.One issue remained:
Ordered
used an abstractcompare
, whileComparable
had an abstractcompareTo
. This was approached by implementingcompareTo
inOrdered
in terms ofcompare
.Some issues remain with that solution:
Ordered
if that class madecompareTo
final. (Example:java.lang.Enum
)Ordered
'scompare
again, even if a super-class has a perfectly fine implementation ofComparable
'scompareTo
, which would be sufficient forOrdered
.Proposed solution:
Ordered
implementscompare
in terms ofComparable
'scompareTo
. A detailed overview of the existing usages will be necessary to figure out the least disruptive way of fixing this issue.