You're describing new features in the Java 7 compiler.
You need to use the Java 7 compiler, with any version of the JRE.
Frage
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:
HashSet<?>
"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?
The second problem is caused by "Set set; set = new HashSet<>()". The problem is gone if you replace HashSet<>()
with HashSet<String>()
. 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?
Thanks in advance, Torben
Lösung
You're describing new features in the Java 7 compiler.
You need to use the Java 7 compiler, with any version of the JRE.