title: Java generics interface implementation
body: <p>I have an interface as follows,</p>
  
  <pre><code>public interface MethodExecutor {
      &lt;T&gt; List&lt;T&gt; execute(List&lt;?&gt; facts, Class&lt;T&gt; type) throws Exception;
  }
  </code></pre>
  
  <p>Also, I have a generic implementation like below,</p>
  
  <pre><code>public class DefaultMetodExecutor implements MethodExecutor {
  
     public &lt;T&gt; List&lt;T&gt; execute(List&lt;?&gt; facts, Class&lt;T&gt; type) throws Exception
     {
       List&lt;T&gt; result = null;
  
        //some implementation
  
        return result;
    }
  }
  </code></pre>
  
  <p>Upto this there is no compilation issues,</p>
  
  <p>But a specific implementation of this interface fails to compile, The one which shown below.</p>
  
  <pre><code>public class SpecificMetodExecutor implements MethodExecutor {
  
     public &lt;Model1&gt; List&lt;Model1&gt; execute(List&lt;Model2&gt; facts, Class&lt;Model1&gt; type) throws Exception
     {
       List&lt;Model1&gt; result = null;
  
       //some implementation specific to Model1 and Model2
  
        return result;
    } 
  }
  </code></pre>
  
  <p>How can I implement this interface for some of the defined objects? Do I need to go for class level generics?</p>