title: Java generics Enum subtyping Interface
body: <p>Given the following setup:</p>
  
  <pre><code>  public class TestType {
  
    public static void main(String[] args) {
      List&lt;Constants&gt; list = new ArrayList&lt;&gt;();
      accept(list); //Does not compile
    }
  
    static void accept(Iterable&lt;MyInterface&gt; values) {
      for (MyInterface value : values) {
        value.doStuff();
      }
    }
  }
  
  interface MyInterface&lt;T&gt; {
    T doStuff();
  }
  
  enum Constants implements MyInterface&lt;Integer&gt; {
    ONE, TWO, THREE;
  
    @Override
    public Integer doStuff() {
      return ordinal();
    }
  }
  </code></pre>
  
  <p>Why won't the compiler accept the list as parameter to accept()?</p>
  
  <p><code>List</code> extends <code>Iterable</code> via <code>Collection</code> so that isn't the problem.</p>
  
  <p>On the other hand, the compiler tells me that
  <code>incompatible types: java.util.List&lt;enums.Constants&gt; cannot be converted to java.lang.Iterable&lt;enums.MyInterface&gt;</code> </p>
  
  <p>But Constants IS  a MyInterface... isn't it?</p>