RFR: JDK-8282776: Bad NullPointerException message when invoking an interface MethodHandle on a null receiver [v5]

Mandy Chung mchung at openjdk.java.net
Tue Mar 29 20:02:36 UTC 2022


> A simple patch to call `Objects.requireNonNull(recv)` for an explicit null receiver check rather than NPE thrown by `Object::getClass`.  The message of NPE generated by JEP 358 (Helpful NullPointerExceptions) is supposed to be helpful but not in this case.

Mandy Chung has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:

 - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8282776
 - per feedback
 - Add exception message
 - Move the null check after isInstance check
 - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8282776
 - JDK-8282776: Bad NullPointerException message when invoking an interface MethodHandle on a null receiver

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/7766/files
  - new: https://git.openjdk.java.net/jdk/pull/7766/files/55c38cf8..5c1d777b

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7766&range=04
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7766&range=03-04

  Stats: 124526 lines in 1656 files changed: 92323 ins; 27724 del; 4479 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7766.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7766/head:pull/7766

PR: https://git.openjdk.java.net/jdk/pull/7766


More information about the core-libs-dev mailing list