Details
-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
None
-
This happens in all environments. Introduced in build 18-ea+24-1608.
-
generic
-
generic
Description
The jdk.internal.reflect.MethodHandleObjectFieldAccessorImpl::set(Object, Object) method handles a class cast exception via:
catch (ClassCastException e) {
throw newSetIllegalArgumentException(obj.getClass());
}
The target, obj can however be null if targeting a static field. In this case, a NullPointerException is thrown instead of the expected IllegalArgumentException.
catch (ClassCastException e) {
throw newSetIllegalArgumentException(obj.getClass());
}
The target, obj can however be null if targeting a static field. In this case, a NullPointerException is thrown instead of the expected IllegalArgumentException.
Attachments
Issue Links
- duplicates
-
JDK-8277451 java.lang.reflect.Field::set on static field with invalid argument type should throw IAE
- Closed