First, my apologies in advance: this isn't really the type of question StackOverflow is intended for, but I don't know where else to ask.
Looking at the documentation for Java enum, I see this:
class Enum<E extends Enum<E>>
Please help me understand the grammar and semantics here. I understand that <E extends X>
means that the formal type E
has to be actual type X
or a subtype of X
. In this case, X
is Enum<E>
and that's where my mind loses the thread, since we're defining Enum
, and it's the same E
.
I bumped into this looking into Enum
but my question applies regardless of the class name.
I've studied the Java tutorials on generics but don't see this addressed. I've looked at the Java language specification in various places but don't see where this kind of recursion is discussed, though perhaps I'm just missing it.