title: Using EnumSet of a enum implementing an interface
body: <p>I have an interface</p>
  
  <pre><code>public interface TerminalSymbol {
      // methods ...
  }
  </code></pre>
  
  <p>an enum</p>
  
  <pre><code>// common usage enum that I need
  public enum Common implements TerminalSymbol {
      EPSILON;
  
      @Override
      // methods ...
  }
  </code></pre>
  
  <p>and I'd like to do something like:</p>
  
  <pre><code>enum Term implements TerminalSymbol {
      A, B, C, ...
  
      @Override
      // methods ...
  }
  
  EnumSet&lt;? extends TerminalSymbol&gt; terminalSymbols = EnumSet.allOf(Term.class);
  terminalSymbol.add(Common.EPSILON); // this line gives me error
  </code></pre>
  
  <p>and that error is (in my case):</p>
  
  <pre><code>The method add(capture#1-of ? extends TerminalSymbol) in the type AbstractCollection&lt;capture#1-of ? extends TerminalSymbol&gt; is not applicable for the arguments (Common)
  </code></pre>
  
  <p>now I know that if I use <code>Set&lt;SomeInterface&gt;</code> I could prevent this type of error (and I could continue with my developing of my class representing a formal grammar) but I'd like to use <code>EnumSet</code> because it's likely to be more efficient than <code>HashSet</code>. How can I solve this problem?</p>