有以下类:
@Entity
public class MPolicy extends MAbstractEntity {
private MPolicyCondition condition;
private List<MPolicyAction> actions;
...
}
@Entity
public abstract class MPolicyCondition extends MAbstractEntity {
}
@Entity
public abstract class MPolicyAction extends MAbstractEntity {
@Column(unique = true)
protected String name;
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
}
为什么错误:
子类型 com.*.MPolicyCondition 不可实例化
出现?
如果我从 MPolicyCondition 中删除抽象关键字,一切正常!但是 MPolicyAction 类也是抽象的。为什么 MPolicyCondition 会影响 bug,但 MPolicyAction 不会?