-
Type:
Bug
-
Status: New
-
Priority:
P4
-
Resolution: Unresolved
-
Affects Version/s: 15.0.1
-
Fix Version/s: None
-
Component/s: specification
-
Subcomponent:
-
CPU:x86_64
-
OS:windows_10
A DESCRIPTION OF THE PROBLEM :
In the JLS for Java 15, section 5.2 (Assignment Contexts), the following conversions are listed:
1) a widening reference conversion followed by an unboxing conversion
2) a widening reference conversion followed by an unboxing conversion, then followed by a widening primitive conversion
These should probably say "narrowing reference conversion". For example, in:
int x = (int) (Object) Integer.valueOf(3);
Object is narrowed to Integer, then unboxed. And in:
int x = (int) (Object) "test";
Object is narrowed to Integer, which fails with ClassCastException at runtime.
The unboxable classes are all final and can't be subclassed, so they can not be widened.
FREQUENCY : always
In the JLS for Java 15, section 5.2 (Assignment Contexts), the following conversions are listed:
1) a widening reference conversion followed by an unboxing conversion
2) a widening reference conversion followed by an unboxing conversion, then followed by a widening primitive conversion
These should probably say "narrowing reference conversion". For example, in:
int x = (int) (Object) Integer.valueOf(3);
Object is narrowed to Integer, then unboxed. And in:
int x = (int) (Object) "test";
Object is narrowed to Integer, which fails with ClassCastException at runtime.
The unboxable classes are all final and can't be subclassed, so they can not be widened.
FREQUENCY : always