RFR: 8272347: ObjectMethods::bootstrap should specify NPE if any argument except lookup is null [v3]

Mandy Chung mchung at openjdk.java.net
Mon Aug 30 01:49:24 UTC 2021


On Thu, 26 Aug 2021 02:36:47 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Please review this simple PR along with the associated CSR. The PR is basically adding a line the the specification of method `java.lang.runtime.ObjectMethods::bootstrap` stating under what conditions a NPE will be thrown.
>> 
>> TIA
>> 
>> link to the [CSR](https://bugs.openjdk.java.net/browse/JDK-8272852)
>
> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
> 
>   clarifying that the names parameter is ignored in some cases

Marked as reviewed by mchung (Reviewer).

src/java.base/share/classes/java/lang/runtime/ObjectMethods.java line 345:

> 343:         Arrays.stream(getters).forEach(Objects::requireNonNull);
> 344:         MethodType methodType;
> 345:         if (type instanceof MethodType)

Since you are modifying this file, do you mind taking Jesper's suggestion [1] posted in another PR to use pattern matching.

Suggestion:

        if (type instanceof MethodType mt)
             methodType = mt;


[1] https://github.com/openjdk/valhalla/pull/528#discussion_r688100918

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

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


More information about the core-libs-dev mailing list