I have the following class structure:
public abstract class Generic<T extends SuperClass>
public class SuperGeneric<T extends SuperClass & SomeInterface>
extends Generic<T>
Now I want to make an instance of SuperGeneric covering all possible classes. I tried it like this:
Generic<? extends SuperClass & SomeInterface> myGeneric
= new SuperGeneric<? extends SuperClass & SomeInterface>();
Now this doesn't seem to work.
On Generic it gives the following error: Incorrect number of arguments for type Generic<T>; it cannot be parameterized with arguments <? extends SuperClass, SomeInterface>.
And on the new SuperGeneric I get a similar error: Incorrect number of arguments for type SuperGeneric<T>; it cannot be parameterized with arguments <? extends SuperClass, SomeInterface>.
Any idea how to correctly create instances of this SuperGeneric?
The idea is that I have 2 different classes that satisfy the extends SuperClass & SomeInterface condition but those cannot be generalized by one type.