2013/6/28 Durchholz, Joachim <[email protected]>

> > I will soon blog about this common caveat when mixing
> > subtype polymorphism with generic polymorphism on the
> > same type. It's a very subtle caveat, but the only type
> > in the type hierarchy that is "allowed" to terminate
> > the generic type recursion is the "lowest" type, which
> > should be a final class! A good example for this is the
> > java.lang.Enum class, whose "recursion-terminating" types are final
> >
> > Here's some more insight on this subject:
> >
> http://blog.jooq.org/2013/06/28/the-dangers-of-correlating-subtype-polymorphism-with-generic-polymorphism
>
> You can always set up the type hierarchy using generics, and make
> subtypable nongeneric subclasses inside your type hierarchy.
>
> I.e.
> abstract class FooImpl <T extends FooImp<T>> {
>   ... lots of code ...
> }
> class Foo extends FooImpl<Foo> {
>   ... no code except maybe constructors ...
> }
>
> I haven't read and grokked the entire post (will hopefully find time to to
> that later), so I may be on a non-sequitur with that.
>

In essence, I'm saying that Foo needs to be final, or you'll shoot yourself
into the foot

-- 
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.


Reply via email to