The following code,
private boolean compare(Object a, int b) {
return a == b;
}
compiles in Java 7, but it results in the following error in Java 8:
incomparable types: int and Object
Looking at the following question:
Comparing Object and int in Java 7
It seems like Java 6 and Java 8 don't let you compare int
and Object
, while 7 does. Is there any documentation on this?
I'm interested in the background knowledge that informed these decisions. It seems like they were undecided or something.
I'm using IntelliJ IDEA 14.1.4 with JDK 1.7.0.51.