title: Overriding generic methods with non-generic implementations
body: <p>I'm experimenting with generics in Java, and thought of this example.</p>
  
  <p>If I have <code>ClassA&lt;T&gt;</code>, I can override it with a subclass that references a concrete class, such as <code>ClassB extends ClassA&lt;String&gt;</code>, then anywhere ClassA uses T, ClassB can use a String.</p>
  
  <p>Now, ignoring the previous <code>ClassA</code> and <code>ClassB</code>, if I have an abstract <code>ClassA</code>, which has a generic method:</p>
  
  <pre><code>public &lt;T&gt; void doSomething(T data);
  </code></pre>
  
  <p>Is there any way I can have a <code>ClassB</code> that overrides it with a concrete class, similar to the previous example? I've come up with something that works, which is to parameterize both the class and the method, but I'm wondering if there's another way.</p>
  
  <pre><code>class ClassA&lt;T&gt; {
      public void doSomething(T data) {};
  }
  </code></pre>
  
  <p>The reason I don't want to put the parameter in the class is because it's only one method that does anything with that type, and some subclasses may not even want to do anything in that method, so I shouldn't need to put a parameter in the class if it's not going to use it.</p>
  
  <p><strong>NOTE</strong>: All of the subclasses of <code>ClassA</code> are anonymous classes, so that adds to the fun.</p>