Java泛型继承的问题,有高手可以解答下吗?
public abstract class BaseEntity<T> implements Serializable {
...
}
public abstract class DataEntity<T> extends BaseEntity<T>{
...
}
public class User extends DataEntity<User>{
...
}
public class Scholar extends User {
...
}
public abstract class CrudService<D extends CrudDao<T>, T extends DataEntity<T>> extends BaseService{
...
}
public class ScholarService extends CrudService<ScholarDao, Scholar>{ //这个地方编译出错
...
}
错误信息:Multiple markers at this line
- Bound mismatch: The type Scholar is not a valid substitute for the bounded parameter <T extends DataEntity<T>> of the type
CrudService<D,T>