title: Java: Cannot implement abstract method taking generic argument
body: <p>I have an abstract class; one of whose abstract methods takes in a polymorphic argument as follows:</p>
  
  <pre><code>public abstract class MetricFunction&lt;T extends MetricFunction&gt; {
  
      public abstract double NDerv(int dervIndex, List&lt;Double&gt; evalPoint);
  
  }
  </code></pre>
  
  <p>Now I attempt to extend this class and implement this abstract method as follows:</p>
  
  <pre><code>public class NumericMetricFunction extends MetricFunction {
  
      @Override
      public double NDerv(int dervIndex, List&lt;Double&gt; evalPoint) {
  
          //Do something...
          double answer = 0.;
  
          return answer;
      }
  }
  </code></pre>
  
  <p>This fails. The IDE (NetBeans in this case) tells me that this method <em>NDerv</em> in <em>NumericMetricFunction</em> does not override a method of the superclass <em>MetricFunction</em>. At the same time, NetBeans acknowledges that the two methods have the same "erasure" (which I assume is a synonym to 'signature').</p>
  
  <p>The IDE advises me that I should instead implement the abstract method as follows:</p>
  
  <pre><code>    @Override
      public double NDerv(int dervIndex, List evalPoint) {
  
          //Do something...
          double answer = 0.;
  
          return answer;
      }
  </code></pre>
  
  <p>When I do this, everything seems to work. However, I lose the more specific type of "evalPoint" as it is now just a generic list.</p>
  
  <p>Why is this happening? What can I do to override this abstract method and still ensure that "evalPoint" is of type <em>List&lt; Double ></em>? I don't want to typecast as that is poor practice; I don't see any reason why my original attempt shouldn't work.</p>
  
  <p><strong>Update:</strong>
  I have slightly altered the code to correctly reproduce the problem.</p>