Why can't you directly cast type in java?
<p>In the code snippet below, why would lines 1 &amp; 2 be fine and line 3 cause a compile error? Aren't the first two lines functionally equivalent to the third?</p>

<pre><code>Loader loader = getLoaderManager().getLoader(0);
PatientLoader patientLoader = (PatientLoader) loader;
patientLoader = (PatientLoader) getLoaderManager().getLoader(0); // ERROR!
</code></pre>

<p>Throws this:</p>

<pre><code>java: somepath/Patient.java:99: inconvertible types
found   : android.content.Loader&lt;java.lang.Object&gt;
required: com.example.package.PatientLoader
</code></pre>

<p><code>PatientLoader</code> indirectly extends <code>Loader&lt;&gt;</code>.</p>

<p>I come from a C# background and in C# this would not be a problem, so maybe I'm missing something about the Java type system.</p>

<p><code>PatientLoader</code> extends <code>AsyncTaskLoader&lt;Cursor&gt;</code>. And anyone familiar w/ Android SDK would know <code>AsyncTaskLoader&lt;&gt;</code> extends <code>Loader&lt;&gt;</code>.</p>
