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

Unintended use of Objects.nonNull in VarHandles

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • None
    • core-libs
    • None

      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.

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

              Created:
              Updated:
              Resolved: