0

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.

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
Jeff Learman
  • 2,914
  • 1
  • 22
  • 31
  • 1
    *this isn't really the type of question StackOverflow is intended for* you're wrong, **these** kind of questions **are allowed** in the site :D but it's a duplicate, so in the end you will get your answer. – Luiggi Mendoza Mar 11 '15 at 17:23
  • "*this isn't really the type of question StackOverflow is intended for*" actually this kind of questions are most interesting ones and make SO place worth visiting. – Pshemo Mar 11 '15 at 17:31
  • Sorry for the duplicate, my google fu has let me down. Thanks! – Jeff Learman Mar 11 '15 at 18:01

0 Answers0