RFR: 8263380: Unintended use of Objects.nonNull in VarHandles
Jorn Vernee
jvernee at openjdk.java.net
Wed Mar 10 16:07:09 UTC 2021
On Wed, 10 Mar 2021 16:04:22 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Use requireNonNull instead.
>
> Well spotted.
Nice catch!
We have a test that is supposed to test this: https://github.com/openjdk/jdk/blob/master/test/jdk/java/foreign/TestNulls.java But it is only checking if an NPE is thrown, and not checking for a message, since `Objects::requireNonNull` does not set an exception message. I guess that test was still passing because NPEs are thrown at some other point during the call.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2914
More information about the core-libs-dev
mailing list