Generic method :
public void foo(T t);
Desired overridden method :
public void foo(MyType t);
W
A better design is.
interface Generic<T> {
void foo(T t);
}
class Impl implements Generic<MyType> {
@Override
public void foo(MyType t) { }
}
interface Base {
public <T> void foo(T t);
}
class Derived implements Base {
public <T> void foo(T t){
}
}
You might want to do something like this :
abstract class Parent {
public abstract <T extends Object> void foo(T t);
}
public class Implementor extends Parent {
@Override
public <MyType> void foo(MyType t) {
}
}
A similar question was answered here as well : Java generic method inheritance and override rules