Integrated: JDK-8282776: Bad NullPointerException message when invoking an interface MethodHandle on a null receiver

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


On Wed, 9 Mar 2022 22:52:41 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 489b27d2
Author:    Mandy Chung <mchung at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/489b27d2c0284f9248bfb0448950698a3f9dee36
Stats:     16 lines in 1 file changed: 10 ins; 0 del; 6 mod

8282776: Bad NullPointerException message when invoking an interface MethodHandle on a null receiver

Reviewed-by: psandoz

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

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


More information about the core-libs-dev mailing list