Alan Burlison wrote:
So it is autoboxing to Integer, then calling intValue(). This sure
looks like a Java bug to me, I've asked internally to see if anyone can
confirm, and if so I'll raise a bug against javac.
The relevant part of the Java spec is here:
http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.25
To paraphrase, the compiler is using autoboxing to convert '1' and
'null' to the same type (Integer), then using intValue() to convert back
to an int.
It's probably not an out-and-out bug, more like a dark corner of
Autoboxing :-)
--
Alan Burlison
--