title: Java Generics Comparable with Inheritance
body: <p>I would like to override a abstract method as follows:</p>
  
  <pre><code>abstract &lt;C extends Comparable&lt;C&gt;&gt; Map&lt;String, Function&lt;E, C&gt;&gt; getSortingMap();
  </code></pre>
  
  <p>The Method overwritten looks like that:</p>
  
  <pre><code>@Override
  Map&lt;String, Function&lt;Contract, Comparable&lt;?&gt;&gt;&gt; getSortingMap() {
      final Map&lt;String, Function&lt;Contract, Comparable&lt;?&gt;&gt;&gt; map = new HashMap&lt;&gt;();
      map.put(Contract.APPRENTICE, e -&gt; e.getApprentice().getLastName()); // String
      map.put(Contract.COMPANY, e -&gt; e.getCompany().getName()); // Name Object
      map.put(Contract.EDUCATION_END, e -&gt; e.getEducationEnd()); // Calendar
      map.put(Contract.STATUS, e -&gt; e.getStatus()); // ENUM
      return map;
  }
  </code></pre>
  
  <p>I have a warning I would like gone without supress warning, because I guess there must be a clean solution:</p>
  
  <pre><code>Type safety: The return type Map&lt;String,Function&lt;Contract,Comparable&lt;?
       &gt;&gt;&gt; for getSortingMap() from the type ContractIntegrationTest needs unchecked 
       conversion to conform to Map&lt;String,Function&lt;Contract,Comparable&gt;&gt; from the type 
       _AbstractFinderServiceIntegrationTest&lt;Contract,ContractFilter,ContractSearch&gt;
  </code></pre>
  
  <p>Is there any way?</p>