> I'm not advocating making everything final. I'm saying that making > any recursive / self-bound *terminator* final is the only way to > *guarantee* that the contracts introduced by the recursive > self-bound in the first place won't be broken.
Ah right. I was so occupied with sorting out the point with covariance and contravariance that that got out of sight. (I first thought that text were saying "covariance is a property of generics"; I had to re-read the text thrice to really see that "of course generics are just one way to have covariance.) I also got misled by the title. It's talking about "dangers", which led me towards looking for type holes. It's just that I don't see any - I have to admit I'm still losing track of what parts of the post describe just preliminary explanations and what parts define the conditions under which a problem pops up, and I've been missing any argument how the conditions are responsible for the problem. At least I can say that Java does not make Foo<Subtype> assignable to Foo<E extends Supertype>, or Bar extends Foo<AnyType> assignable to Foo<AnyType>, so the usual "parameter covariance makes a subclass SO not a subtype" problem is not present. (Unsurprisingly. Gilad Bracha and the other guys who designed Java's generics are widely-recognized type system experts.) So... I'm not seeing a type hole. What I do see is an annoying type error message from the compiler if you try to subclass AppleContainer with GalaContainer and want GalaContainer.container() have return the GalaContainer. But that's easily fixable! Just override container() to return GalaContainer. No relationship to generics at all, it's a standard problem in subtype definitions. ... I just hope I'm not overlooking something glaringly obvious :-) -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
