title: Problem with generic class and class Type
body: <p>I have created a (generic) class Store, which I use to get 3 stores(smithy, jeweler and bookstore). The store is basically just an ArrayList, which holds different objects, that can be bought in each store. Now I want to limit the smithy to only hold weapons, the jeweler to only hold rings, etc.</p>
  <p>I tried realizing that like this:</p>
  <pre><code>    Store&lt;Weapon&gt; smithy = new Store&lt;&gt;();
      Store&lt;Ring&gt; jeweler = new Store&lt;&gt;();
      Store&lt;Scroll&gt; bookstore = new Store&lt;&gt;();
  </code></pre>
  <p>However do I get an error later on in the code, because the method only accepts the type<code>(Object, Store&lt;Object&gt;)</code> and not <code>(Object,Store&lt;Weapon&gt;)</code>. But the Weapon class is a subclass of my Object class, so I don't understand why this is a problem.</p>
  <p>My Store class:</p>
  <pre><code>public class Store &lt;T extends Object&gt;{
  /...
  }
  </code></pre>
  <p>My Object Class:</p>
  <pre><code>public class Object {
  
      //Konstruktor
      public Object() {
      
      }
  }
  </code></pre>
  <p>My Weapon class :</p>
  <pre><code>public class Weapon extends Object  {
      //Konstruktor
      public Weapon () {
          super();
      };
  </code></pre>
  <p>The piece of code I get the problem in:</p>
  <pre><code>this.myPlayer.buy(this.smithy.getItemAt(itemNr), this.smithy);
  </code></pre>
  <p>The buy method:</p>
  <pre><code>public void buy(Object obj, Store&lt;Object&gt; store){
  //...}
  </code></pre>
  <p>the error:</p>
  <pre><code>the method buy(Object,Store&lt;Object&gt;) in the type Player is not applicable for the arguments (Object, Store&lt;Weapon&gt;)
  </code></pre>
  <p>Since I have three different stores with each their own kind of Objects(Weapon, Ring, Scroll) I cannot just change the buy method to <code>(Object, Store&lt;Weapon&gt;)</code>. And writing three methods for each store seems a bit much to me.</p>
  <p>I appreciate your helping.</p>