Details
-
Type:
Bug
-
Status: Closed
-
Priority:
P4
-
Resolution: Cannot Reproduce
-
Affects Version/s: 5.0, 6
-
Fix Version/s: None
-
Component/s: tools
-
Labels:
-
Subcomponent:
-
CPU:generic
-
OS:generic
Description
boolean b = (3 == (Object)null);
compiles because javac performs a boxing conversion followed by a
widening reference conversion. This isn't currently a valid combination
under casting conversion (as required by 15.21.3) but 6526446 will
expand casting conversion and it will become valid.
However, this does not compile, and should:
boolean b = ((Object)null == 3); // incomparable types: java.lang.Object and int
compiles because javac performs a boxing conversion followed by a
widening reference conversion. This isn't currently a valid combination
under casting conversion (as required by 15.21.3) but 6526446 will
expand casting conversion and it will become valid.
However, this does not compile, and should:
boolean b = ((Object)null == 3); // incomparable types: java.lang.Object and int
Attachments
Issue Links
- duplicates
-
JDK-6558572 javac accepts semantically invalid == test
-
- Closed
-
- relates to
-
JDK-6979683 inconsistent interaction of reference cast with box/unbox conversions leaves out a useful case
-
- Closed
-
-
JDK-6790039 overhaul cast-conversion (umbrella)
-
- Closed
-
-
JDK-6526446 Fixes to JLS5.5 Casting Conversion
-
- Closed
-