这可能是一个愚蠢的问题,但我无法理解为什么下面的编译失败了.
我的班级层次结构
Dao.java
public interface Dao {
E create(E e) throws Exception;
}
这个Dao有一个通用的实现
DaoImpl.java
public abstract class DaoImpl implements Dao {
@Override
public E create(E e) throws Exception {
throw new UnsupportedOperationException("this operation is not supported");
}
}
然后有专门的实施
ProcessDaoImpl.java
public class ProcessDaoImpl extends DaoImpl {
@Override // this is where compilation is failing,I get the error that create doesn't override a superclass method
public Process create(Process entity) throws Exception {
return null;
}
}
实体类层次结构的描述
Process.java
public class Process extends AuditEntity {
// some pojo fields
}
AuditEntity.java
public abstract class AuditEntity extends IdentifiableEntity {
// some pojo fields
}
IdentifiableEntity.java
public abstract class IdentifiableEntity extends Entity {
// some pojo fields
}
Entity.java
public abstract class Entity implements Serializable {
}