Joda's AbstractInstant interface extends the raw type Comparable
, instead of Comparable
, which seems to violate Java best practices. In particular, it means that I cannot use DateTime to parameterize a class like this:
class Foo> {
public int ct(T a, T b) {
return a.compareTo(b);
}
}
It was my understanding this kind of class was perfectly valid (it certainly works with Double, etc.). To get it to work with DateTime, though, I have litter my own code with the raw type and suppressed warnings:
@SuppressWarnings("unchecked")
class Foo {
public int ct(T a, T b) {
return a.compareTo(b);
}
}
There is a related question that suggests a workaround (wrapping the DateTime in another class for the purposes of comparison), but I don't see why that should be necessary. My question then is: