Java Generics Bound mismatch with a raw type?

Up vote 2 down vote favorite share g+ share fb share tw.

I have a super class with a signature like public abstract class Foo>{..} So the C class is supposed to be a Comparable object. I want to use org.joda.time. Instant (version 1.6) as the type parameter in a subclass public class SubFoo unfortunately I get this error: Bound mismatch: The type Instant is not a valid substitute for the bounded parameter > of the type BigtablePoller The Instant class extends AbstractInstant which implements Comparable (no type parameters) Is there any way around this issue?

The only way I have been able to make it work is to change Foo to: @SuppressWarnings("rawtypes") public abstract class Foo {} I would like to avoid the warning and Josh Bloch says not to use raw types in new code (effective java Item 23). Java generics jodatime link|improve this question edited Aug 27 '11 at 19:00 asked Aug 25 '11 at 4:00luke4,486725 88% accept rate.

Just use this: public abstract class Foo> The reason your version doesn't work is that Instant is defined as extends Comparable not extends Comparable. If you use bounding, the bounding has to match too.

Unfortunately that doesn't work either. The only thing I have been able to make work is , but then I need to suppress warnings... – luke Aug 25 '11 at 14:14 > is much better than > "Instant is defined as extends Comparable" Not it is not; see the OP's post: Instant extends AbstractInstant which implements Comparable. If this were made generic, it would likely implement Comparable, and therefore not compatible with Comparable, but would be compatible with Comparable – newacct Aug 26 '11 at 9:11.

Joda time 1.6 doesn't support Generics so there are three options. Create a wrapper class that implements the correct interface and use that. Suppress Warnings on the super class and deal with the uglyness upgrade to joda time 2.0 which supports the generic comparable interface on Instant.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions