oop - Java Bound Mismatch in recursive generics/inheritance -
i have following structure:
public abstract class <e extends el, u extends a<e,u> > { ... }
public class b<e extends el> extends a<e, b<e> > { ... }
public abstract class c <e extends el, t extends a<e, t>> { ... }
my question is, why can this:
public class r extends c<el, b<el>> { ... }
but not
public class r <t extends b<el>> extends c<el, t> { ... }
why t (which extends b<el>) not substitute b<el>?
the exception bound mismatch: type t not valid substitute bounded parameter <t extends a<el,t>> of type c<e,t>
try declare a , c follows
public abstract class <e extends el, u extends a<e, ? super u>> {} public abstract class c <e extends el, t extends a<e, ? super t>> {}
Comments
Post a Comment