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

Mandy Chung mchung at openjdk.java.net
Fri Mar 11 22:49:25 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 three additional commits since the last revision:

 - 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/8af60582..c7224f2f

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

  Stats: 688 lines in 35 files changed: 522 ins; 56 del; 110 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