Reputation: 31225
I try to do a generic class like this :
public abstract class MyClass<A extends MyInterface,B,C> implements A{
...
}
(Note: B and C are not interfaces, just other generic params)
I get a compilation error because there is absolutely no guarantee that A
is an interface. Hence, the abstract class cannot implements A
Is there a way to tell the compiler that A must be an interface?
Upvotes: 1
Views: 137
Reputation: 4624
No, Since you are using clause which after compilation will have following form like:
public abstract class MyClass implements java.lang.Object {
You can add implements MyInterface, B, C
since that would check whether these interfaces are implemented.
Upvotes: 3