title: Generic method parameter: enum which implements an interface
body: <p>I have an <code>interface</code>:</p>
  <pre><code>public interface NamedEnum {
      String getName();
  }
  </code></pre>
  <p>An <code>enum</code> which implements the <code>interface</code>:</p>
  <pre><code>public enum MyEnum implements NamedEnum {
      
      MYVALUE1(&quot;My value one&quot;),
      MYVALUE2(&quot;My value two&quot;);
      
      private String name;
      
      private MyEnum(String name) {
          this.name = name;
      }
  
      public String getName() {
          return name;
      }
  }
  </code></pre>
  <p>A method which doesn't compile:</p>
  <pre><code>public static Map&lt;Integer,String&gt; wrong(Enum&lt;? extends NamedEnum&gt; value) {
      Map&lt;Integer,String&gt; result = new LinkedHashMap&lt;Integer, String&gt;();
      for (Enum&lt;? extends NamedEnum&gt; val : value.values())
          result.put(val.ordinal(), val.getName());
      return result;
  }
  </code></pre>
  <p>Two errors:</p>
  <blockquote>
  <p><code>The method values() is undefined for the type Enum&lt;capture#1-of ? extends NamedEnum&gt;</code></p>
  </blockquote>
  <blockquote>
  <p><code>The method getName() is undefined for the type Enum&lt;capture#3-of ? extends NamedEnum&gt;</code></p>
  </blockquote>
  <p>I can't figure out how the method above can accept an <code>enum</code> which implements the <code>interface</code>.</p>