title: Java generics and bounded types
body: <p>I have a wrapper class for ConcurrentMap like the following:</p>
  
  <pre><code>public MapWrapper&lt;K, V&gt; implements ConcurrentMap&lt;K, V&gt; {
  
      private final ConcurrentMap&lt;K, V&gt; wrappedMap;
  
      ...
      @Override
      public void putAll(Map&lt;? extends K, ? extends V&gt; map) {
          wrappedMap.putAll(map);  // &lt;--- Gives compilation error
      }
      ...
  }
  </code></pre>
  
  <p>The marked line triggers the following compilation error: </p>
  
  <pre><code>method putAll in interface java.util.Map&lt;K,V&gt; cannot be applied to given types;
  required: java.util.Map&lt;? extends capture#5 of ? extends K,? extends capture#6 of ?
      extends V&gt;
  found: java.util.Map&lt;capture#7 of ? extends K,capture#8 of ? extends V&gt;
  reason: actual argument java.util.Map&lt;capture#7 of ? extends K,capture#8 of ? extends V&gt; 
      cannot be converted to java.util.Map&lt;? extends capture#5 of ? extends K,? extends 
      capture#6 of ? extends V&gt; by method invocation conversion
  </code></pre>
  
  <p>I suspect the unbounded wildcards are the culprit but I can't change the method signature since it is inherited from the ConcurrentMap interface. Any ideas?  </p>