title: Overriding a method using type erasure
body: <p>Today I stumbled upon something interesting.
  Assume the following Java 6 class:</p>
  
  <pre><code>public class Ereasure {
  
      public Object get(Object o) {
          return null; // dummy
      }
  
      public  static class Derived&lt;T&gt; extends Ereasure{
          // (1)
          @Override
          public Object get(T o) {
                  return super.get(o);
          }
          // (2)
          /*
          @Override
          public Object get(Object o) {
                  return super.get(o);
          }*/
  
      }
  }
  </code></pre>
  
  <p>If you try to compile the above example, the compiler says
      Ereasure.java:9: method does not override or implement a method from a supertype
          @Override
  If you remove the @Override annotation(which should not be necessary!), it says
      Ereasure.java:8: name clash: get(T) in Ereasure.Derived and get(java.lang.Object) in Ereasure have the same erasure, yet neither overrides the other
  This is a bit contradictional, since T should erease to Object and therefor override the parent classes get method.</p>
  
  <p>If you leave (1) unannotated and uncomment (2) so (1) overloads (2) it would not work either. 
  Compiler output:</p>
  
  <pre><code>Ereasure.java:15: get(T) is already defined in Ereasure.Derived
    public Object get(Object o) {
  </code></pre>
  
  <p>As a conclusion, T is being ereased to Object, but cannot override the parent get Method.</p>
  
  <p>My question is now, why dooesn't at least one of the examples compile?</p>