title: Java Generics - Class a Subclass of itself?
body: <p>I'm currently reading Java Generics, and I am a bit stuck when it comes to Wildcards.</p>
  
  <p>I have been given this method from the Collections class:</p>
  
  <pre><code>public void &lt;T&gt; copy(List&lt;? super T&gt; dest, List&lt;? extends T&gt; src) {
      for(int i = 0; i &lt; src.size(); i++) {
          dest.set(i, src.get(i));
       }
  }
  </code></pre>
  
  <p>I have then been told that it is possible to call the method like this:</p>
  
  <pre><code>List&lt;Object&gt; objs = new ArrayList&lt;Object&gt;();
  List&lt;Integer&gt; ints = new ArrayList&lt;Integer&gt;();
  Collections.copy(objs, ints);
  </code></pre>
  
  <p>As the type parameter has been left to the compiler to determine, the book says the compiler chooses the type parameter to be Integer.</p>
  
  <p>But how is that possible?</p>
  
  <p>If it were taken to be Integer, this would mean that in the method declaration -<br>
  <code>List&lt;? extends T&gt;</code> would translate to <code>List&lt;Integer extends Integer&gt;</code>.</p>
  
  <p>Is this a mistake, or are there different rules when regarding Generics? I have googled around and the majority of results say that a class cannot be a subclass of itself.</p>