title: Generic class compiles in Java 6, but not Java 7
body: <p>I have an interface in Java 6 that compiles correctly:</p>
  
  <pre><code>public interface IMultiMap&lt;K, V&gt; extends Map&lt;K, Set&lt;V&gt;&gt; {
  
      public int valueSize();
  
      public boolean put(K key, V value);
  
      public void clear(Object key);
  
      public boolean isEmpty(Object key);
  }
  </code></pre>
  
  <p>But in Java 7, this interface doesn't compile. I get a compile error on <code>boolean put(K, V)</code> that it has the same erasure as <code>V put(K, V)</code>. The full error from the compiler:</p>
  
  <pre><code>error: name clash: put(K#1,V#1) in IMultiMap and put(K#2,V#2) in Map have the same erasure, yet neither overrides the other
      public boolean put(K key, V value);
    where K#1,V#1,K#2,V#2 are type-variables:
      K#1 extends Object declared in interface IMultiMap
      V#1 extends Object declared in interface IMultiMap
      K#2 extends Object declared in interface Map
      V#2 extends Object declared in interface Map
  </code></pre>
  
  <p>For the record, adding any kind of overriding doesn't work. I tried explicitly overriding <code>Map.put</code>, but the error still comes up. Changing the return type of my <code>put</code> is moot since this error is blocking that potential error from ever being reached, and if this error were fixed, then the two methods wouldn't have the same name/parameter signature anyway.</p>
  
  <p>I think I might try some reflection on Java 6 and see what the actual parameter types end up being in Java 6's compiled bytecode. It's clear that both Java 7 methods are being erased to <code>put(Object, Object)</code>. I'll post the reflection results here once I do that.</p>
  
  <p>In the meantime, my temporary workaround will be just to rename <code>put</code> to <code>putSingle</code>, but is this new behavior correct? Did some part of the generics specifications change for Java 7 that makes the old Java 6 behavior wrong? Or is this a bug in the Java 7 compiler?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDIT:</strong> I ran the reflection code. Check out my answer below.</p>