title: Why in java enum is declared as Enum<E extends Enum<E>>
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/211143/java-enum-definition">java Enum definition</a>  </p>
  </blockquote>
  
  
  
  <blockquote>
    <p><strong>Better formulated question, that is not considered a duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3067891/what-would-be-different-in-java-if-enum-declaration-didnt-have-the-recursive-pa">What would be different in Java if Enum declaration didn't have the recursive part</a></p>
  </blockquote>
  
  <p>if language designers were to use simply Enum&lt;E extends Enum&gt; how would that affect the language?</p>
  
  <p>The only difference now would be that someone coud write </p>
  
  <pre>
  A extends Enum&lt;B&gt;
  </pre>
  
  <p>but since it is not allowed in java to extend enums that would be still illegal. 
  I was also thinking about someone supplying jvm a bytecode that defines smth as extending an enum - but generics can't affect that as they all are erased.</p>
  
  <p>So what is the whole point of such declaration?</p>
  
  <p>Thank you!</p>
  
  <p><b>Edit</b>
  for simplicity let's look at an example:</p>
  
  <pre>
  interface MyComparable&lt;T> {
      int myCompare(T o);
  }
  
  class MyEnum&lt;E extends MyEnum> implements MyComparable&lt;E> {
      public int myCompare(E o) { return -1; }
  }
  
  class FirstEnum extends MyEnum&lt;FirstEnum> {}
  
  class SecondEnum extends MyEnum&lt;SecondEnum> {}
  </pre>
  
  <p>what's wrong with this class structure? What can be done that "MyEnum&lt;E extends MyEnum&lt;E>>" would restrict?</p>