Why doesn't line 4 generate an unchecked exception?
<pre><code>/*1.*/ List l = new ArrayList&lt;Number&gt;();
/*2.*/ List&lt;String&gt; ls = l;       // unchecked warning
/*3.*/ l.add(0, new Integer(42)); // another unchecked warning
/*4.*/ String s = ls.get(0);
</code></pre>

<p>If the lines 2 and 3 produce an unchecked warning then why doesn't the 4th line generate a unchecked warning since compiler does not know what 'ls' is referring to (<code>List&lt;String&gt;</code> or <code>List&lt;Integer&gt;</code>).</p>

<p>(Note: edited from the OP's original post to make the code display as presumably intended - notably include the type parameters for <code>List&lt;E&gt;</code> everywhere.)</p>
