title: Java 7: Cannot cast from Object to int etc
body: <p>I'm having a problem running someones code in Eclipse 3.6 (Helios). The code is written with OpenJDK 7. I'm running Windows 7 and I had to install Java 7 for it. I was using Java 6 before. I get 2 kinds of errors running the code:</p>
  
  <ol>
  <li>"Cannot cast from Object to int" (also: double, long, boolean)</li>
  <li>"Cannot instantiate the type <code>HashSet&lt;?&gt;</code>"</li>
  </ol>
  
  <p>I read casts like "(int) obj" are only possible in Java 7. In Java 6 it has to be "(Integer) obj" instead. But I set the "JRE System Library" to JRE7 and I still get that error. Is it still somehow using JRE6?</p>
  
  <p>The second problem is caused by "Set set; set = new HashSet&lt;>()". The problem is gone if you replace <code>HashSet&lt;&gt;()</code> with <code>HashSet&lt;String&gt;()</code>. Is this another Java 7 change? And why is it not working with my JRE7? Is my Eclipse too old and only able to run JRE6?</p>
  
  <p>Thanks in advance,
  Torben</p>