title: Type safety: Unchecked cast
body: <p>In my spring application context file, I have something like:</p>
  <pre><code>&lt;util:map id=&quot;someMap&quot; map-class=&quot;java.util.HashMap&quot; key-type=&quot;java.lang.String&quot; value-type=&quot;java.lang.String&quot;&gt;
      &lt;entry key=&quot;some_key&quot; value=&quot;some value&quot; /&gt;
      &lt;entry key=&quot;some_key_2&quot; value=&quot;some value&quot; /&gt;   
  &lt;/util:map&gt;
  </code></pre>
  <p>In java class, the implementation looks like:</p>
  <pre><code>private Map&lt;String, String&gt; someMap = new HashMap&lt;String, String&gt;();
  someMap = (HashMap&lt;String, String&gt;)getApplicationContext().getBean(&quot;someMap&quot;);
  </code></pre>
  <p>In Eclipse, I see a warning that says:</p>
  <p><strong>Type safety: Unchecked cast from Object to HashMap&lt;String,String&gt;</strong></p>
  <p>What went wrong?</p>