I have a collection with the element type <K extends Comparable<K>> because it is ordered.
I am trying to use Joda LocalTime with this collection - for example. MyCollection<LocalTime> . Unfortunately, Yoda seems to be pre-generics; LocalTime implements raw Comparable .
I get a compiler error
Bound mismatch: The type LocalTime is not a valid substitute for the bounded parameter <K extends Comparable<K>> of the type Interval<K>
I would expect this to work only with a warning, since it is entirely possible to assign a raw type to a typed variable.
Why does this not work, and what can I do about it?
Here's a minimal code example:
class Holder<K extends Comparable<K>> { } class WTF extends Holder<LocalTime> { }
java collections generics jodatime
Steven schlansker
source share