-
Type:
Sub-task
-
Resolution: Unresolved
-
Priority:
P4
-
None
-
Affects Version/s: 8
-
Component/s: core-libs
-
None
When calling MethodHandles.constant(...) with a primitive type and a null value (e.g. MethodHandles.constant(int.class, null)), a NullPointerException is thrown.
However, the specification says:
@throws NullPointerException if the {@code type} argument is null
and
@throws ClassCastException if the value cannot be converted to the required return type
So, either the specification should be changed to include this scenario in the throws NPE case, or the implementation should be changed to throw a CCE instead.
However, the specification says:
@throws NullPointerException if the {@code type} argument is null
and
@throws ClassCastException if the value cannot be converted to the required return type
So, either the specification should be changed to include this scenario in the throws NPE case, or the implementation should be changed to throw a CCE instead.
- relates to
-
JDK-8177152 Several methods in java.lang.invoke don't specify treatment of nulls
-
- Open
-