title: Boundly-extended Wildcards in java Generics
body: <p>I was experimenting with Generics for a while and I've come up with smt i cannot explain:</p>
  
  <p>If we have such method that return first element of a collection:</p>
  
  <pre><code>public static &lt;T&gt; T magic_method(List&lt;? extends T&gt; coll) {
      return coll.get(0);
  }
  </code></pre>
  
  <p>And let's say we call it like this:</p>
  
  <pre><code>List&lt;Integer&gt; l = Arrays.asList(12345);
  System.out.println(magic_method(l));
  </code></pre>
  
  <p>So, my question is <strong>What is actual returned type in magic_method ?</strong></p>
  
  <pre><code>&lt;? extends T&gt; 
  </code></pre>
  
  <p>If we pass Collection of <code>Integer</code> does the compiler automatically "understand" that 
  <code>T</code> should be <code>Number</code> (Since <code>Number</code> is super-class of <code>Integer</code>) ?</p>
  
  <p>Or am i missing something?</p>