public abstract class HistorizableStatusEntity<S extends Status,
O extends IdentifiedEntity> extends IdentifiedEntity
與一個具體的實現:
public class OrderStatusHistory extends HistorizableStatusEntity<OrderStatus, Order>
現在有:
public abstract class StatusableEntity<H extends HistorizableStatusEntity<S, IdentifiedEntity>,
S extends Status> extends IdentifiedEntity
與一個具體的實現:
public class Order extends StatusableEntity<OrderStatusHistory, OrderStatus>
Java編譯器說關於Order
:
Bound mismatch: The type OrderStatusHistory is not a valid substitute for the bounded parameter <H extends HistorizableStatusEntity<S,IdentifiedEntity>> of the type StatusableEntity<H,S>
我不明白這一點,因爲OrderStatusHistory延伸HistorizableStatusEntity<S,IdentifiedEntity>>
。
任何想法? TIA!
但是Order擴展了StatusableEntity,它擴展了IdentifiedIdentity .. – Joni
然後在'StatusableHistory'中使用邊界。在你的代碼片段中,你不允許使用'IdentifiedIdentity'的子類,你需要一個嚴格的類型匹配 – Dici
'boundary'是什麼意思? – t777