I seem to have painted myself in to a bit of a generics coloured corner. Basically I have a generic Interface X<T1, T2 extends Y<?, ?>>
with a bunch of methods, including a T1 getFirstClass()
, and a T2 getSecondClass()
. This works fine for most things, but one of the things I need to do with this is find instances of this Class that are super classes of what I'm looking up, and I need a "catch-all" object for those that can't be found. This means I end up with a Class that looks like:
public class A implements X<Object, Y<?, ?>> {
...
public Class<Y<?, ?>> getSecondClass() {
return ????
}
}
I tried dealing with this by ignoring the <?, ?>
bit and using @SuppressWarnings("rawtypes")
, which works in Eclipse, but when built by ant, gives the error message type parameter Y is not within its bound
. The JDK should be the same - I'm only aware of one being installed on my system, namely 1.6.0_23 (I unfortunately can't update this due to factors beyond my control).
Is there any way I can get around this or am I going to have to go back to the drawing board and redesign my classes?