这可能是一个愚蠢的问题,但我无法理解为什么下面的编译失败了.
我的班级层次结构
Dao.java
public interface Dao<E extends Entity, S extends SearchCriteria> {
<E> E create(E e) throws Exception;
}
Run Code Online (Sandbox Code Playgroud)
这个Dao有一个通用的实现
DaoImpl.java
public abstract class DaoImpl<E extends Entity, S extends SearchCriteria> implements Dao<E, S> {
@Override
public <E> E create(E e) throws Exception {
throw new UnsupportedOperationException("this operation is not supported");
}
}
Run Code Online (Sandbox Code Playgroud)
然后有专门的实施
ProcessDaoImpl.java
public class ProcessDaoImpl extends DaoImpl<Process, WildcardSearchCriteria> {
@Override // this is where compilation is failing, I get the error that create doesn't override a superclass method …Run Code Online (Sandbox Code Playgroud)