Compiler complains about "missing return statement" even though it is impossible to reach condition where return statement would be missing
<p>In the following method, the compiler complains about a <em>missing return statement</em> even though there is only a single path through the method, and it contains a <code>return</code> statement. Suppressing the error requires another <code>return</code> statement. </p>

<pre><code>public int foo() {
    if (true) {
        return 5;
    }
}
</code></pre>

<p>Given that the <a href="http://stackoverflow.com/questions/1958563/does-java-recognize-infinite-loops">Java compiler can recognize infinite loops</a>, why doesn't it handle this situation as well? The linked question hints, but doesn't provide details for this specific case.</p>
