Draft proposal: allow the use of relational operators on Comparable classes
Vilya Harvey
vilya.harvey at gmail.com
Tue Mar 10 17:40:10 PDT 2009
Hi Reiner,
Your replies to the earlier messages have said pretty much exactly what I
would have said; thanks for that! Just one thing:
2009/3/11 Reinier Zwitserloot <reinier at zwitserloot.com>
> Easily fixed in the proposal by stating: If the operation would
> succeed under old unboxing rules, use those.
>
You'll notice I actually said just that (although not quite as clearly or
succinctly) in the proposal. :-)
but you can not call x.compareTo(y), or y.compareTo(x). (AFAIK - it
> would be nice if someone tests this theory. Don't have a javac
> available at the moment).
>
I tested that while writing the proposal. x.compareTo(y) fails to compile
because Comparable is a generic interface: x actually implements
Comparable<Float>, which requires a Float as the argument to compareTo.
Likewise y implements Comparable<Double>.
Cheers,
Vil.
More information about the coin-dev
mailing list