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

Unintended use of Objects.nonNull in VarHandles

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 17
    • Component/s: core-libs
    • Labels:
      None

      Description

      VarHandles uses Objects.nonNull(foo) like this in various places:

          public static VarHandle insertCoordinates(VarHandle target, int pos, Object... values) {
              Objects.nonNull(target);
              Objects.nonNull(values);

      nonNull is a boolean predicate (return arg != null;). It appears likely the intent was to call Objects.requireNonNull as a precondition check here.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              redestad Claes Redestad
              Reporter:
              redestad Claes Redestad
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: