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

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P4
    • None
    • Affects Version/s: None
    • Component/s: core-libs
    • Environment:

      This happens in all environments. Introduced in build 18-ea+24-1608.

      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.

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

              Created:
              Updated:
              Resolved: