title: Incompatible types when declaring subclass
body: <p>With this code, compiler tells me I have incompatible Types ("required Set&lt; Item> but have Set&lt; Weapon>").</p>
  
  <pre><code>import java.util.Set;
  
  class clazz extends AbstractClass{
      private Set&lt;Weapon&gt; items;
  
      @Override
      Set&lt;Item&gt; getItems() {
          return items; //Incompatible Types here
      }
  }
  
  abstract class AbstractClass {
      abstract Set&lt;Item&gt; getItems();
  }
  
  interface Item {
  }
  
  interface Weapon extends Item {
  }
  </code></pre>
  
  <p>I don't get it, if Weapon is a subInterface of Item, I think I should be able to use it in place of Items.   </p>
  
  <p>I can fix the problem by writing </p>
  
  <pre><code>import java.util.Set;
  
  class clazz extends AbstractClass{
      private Set&lt;Weapon&gt; items;
  
      @Override
      Set&lt;? extends Item&gt; getItems() {
          return items;
      }
  }
  
  abstract class AbstractClass {
      abstract Set&lt;? extends Item&gt; getItems();
  }
  </code></pre>
  
  <p>Can you explain to me why is this not permitted ?</p>