The problem:
base interface:
IBase
descendants:
InterfaceA extends IBase<Interface1>
InterfaceB extends IBase<Interface2>
When I try:
InterfaceC extends InterfaceA, InterfaceB
I receive compile error:
The interface IBase cannot be implemented more than once with different arguments
Does exist workaround?
Thanks.
This is not possible and it cannot be in Java, at least.
Think of the following scenario:
When you go try to implement AB, if it were possible, what type would the get() method return. In Java, two methods in a class cannot have the same name/args but different return types…. hence, this is forbidden.
If you actually need some functionality similar to what you would get should Java allow this, I would suggest the following:
Or, to keep generics: