I have the following test code:
public interface Container<I> {
public void addClass(Class<?> clazz);
}
public class MyContainer implements Container {
public void addClass(Class<?> clazz) {}
}
and I get the following error when trying to compile these two class:
MyContainer.java:1: MyContainer is not abstract and does not override abstract method addClass(java.lang.Class) in Container
If I add a type to the Container interface in MyContainer (such as <Object>
), I don't get the error.
The problem is I'm introducing the type parameter to Container, which is part of the public API, so for compatibility, I can't have all implementing classes unable to compile.
Anyone have any ideas? Is it a type erasure issue? Is there a workaround?
Thank you