Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8277510

Refactored reflection throws null pointer when setting unassignable type on static field

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • None
    • None
    • core-libs
    • This happens in all environments. Introduced in build 18-ea+24-1608.

    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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              winterhalter Rafael Winterhalter
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: