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

Mandy Chung mchung at openjdk.java.net
Wed Mar 23 03:40:27 UTC 2022


On Wed, 23 Mar 2022 02:01:08 GMT, ExE Boss <duke at openjdk.java.net> wrote:

>> Mandy Chung has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add exception message
>
> src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java line 424:
> 
>> 422:                     throw new IncompatibleClassChangeError(msg);
>> 423:                 } else {
>> 424:                     throw new NullPointerException("Cannot invoke " + member + " with null receiver");
> 
> Suggestion:
> 
>                     String msg = String.format("Cannot invoke %s with null receiver",
>                                                member);
>                     throw new NullPointerException(msg);

Good catch.   Will update it.

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

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


More information about the core-libs-dev mailing list