title: Java generics incompatible types compilation error for generic static method call in Oracle Java SE 8u20 JDK
body: <p>When compiling the code below with the Oracle Java SE 8u20 JDK, the first three assignments compile fine (for the <code>works*</code> variables), but the fourth assignment (for the <code>fails1</code> variable) generates the following compilation error:</p>
  
  <p>Error:</p>
  
  <pre><code>incompatible types: Set&lt;Set&lt;Object&gt;&gt; cannot be converted to Set&lt;Set&lt;? extends Object&gt;&gt;
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>import java.util.Set;
  import java.util.Collections;
  
  ...
  
  Set&lt;? extends Object&gt;      works1 = Collections.&lt;Object&gt;emptySet();
  Set&lt;Set&lt;Object&gt;&gt;           works2 = Collections.&lt;Set&lt;Object&gt;&gt;emptySet();
  Set&lt;Set&lt;? extends Object&gt;&gt; works3 = Collections.&lt;Set&lt;? extends Object&gt;&gt;emptySet();
  Set&lt;Set&lt;? extends Object&gt;&gt; fails1 = Collections.&lt;Set&lt;Object&gt;&gt;emptySet();
  </code></pre>
  
  <p>I assume that this is correct (probably due to some sort of type erasure defined in the Java language specification), rather than being a bug, but I don't know for sure.</p>
  
  <p>Does anyone know why <code>fails1</code> fails to compile?  A reference to the applicable part of the Java spec, or to a JDK bug report, would be appreciated.</p>
  
  <p>Thanks for any help.</p>