title: Java generics and inheritance
body: <p>I have the following abstract classes:</p>
  
  <pre><code>public abstract class AbSuperClass1&lt;K,S&gt; {
      //class definition
  }
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>public abstract class AbSuperClass2&lt;K,S&gt; {
      public abstract &lt;Q extends AbSuperClass1&lt;K,S&gt;&gt; void method(Q arg);
      ...
  }
  </code></pre>
  
  <p>I then have two concrete implementations</p>
  
  <pre><code>public class Concrete1 extends AbSuperClass&lt;String, String&gt;{
      //class definition
  }
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>public class Concrete2 extends AbSuperClass2&lt;String, String&gt;{
      public void method(Concrete1 arg){
          //method definition
      }
  }
  </code></pre>
  
  <p>This will not, however, compile, as Concrete1 is not recognised as a valid type for the argument of method in Concrete2, but as far as I can see Concrete1 is of the correct type, since it extends AbSuperClass1.</p>
  
  <p>Where am I going wrong?</p>