The following code
public class TestComparison {
public static void main(String[] args) throws Exception {
boolean b = true;
Object o = n
It's your project language level setting. You are probably using a Java 7 compiler with Java 6 semantics. I don't have Eclipse here, but I reproduced it in IntelliJ, which gave errors when the language level was on Java 6, even though the compiler I used was 7. I guess Eclipse has the same. This link explains it.