RFR: 8272347: ObjectMethods::bootstrap should specify NPE if any argument except lookup is null [v2]
Mandy Chung
mchung at openjdk.java.net
Wed Aug 25 02:20:32 UTC 2021
On Tue, 24 Aug 2021 03:03:37 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/runtime/ObjectMethods.java line 327:
>>
>>> 325: * @throws IllegalArgumentException if the bootstrap arguments are invalid
>>> 326: * or inconsistent
>>> 327: * @throws NullPointerException if any argument but {@code lookup} is {@code null}
>>
>> `names` may be null if the {@code methodName} is {@code "equals"} or {@code "hashCode"}. This should be captured here.
>
> Hi Mandy, I have changed the implementation of the method to explicitly require all arguments but lookup to be non-null as suggested by Brian. I have also covered, I think, all the missing test cases in test `ObjectMethodsTest`, thanks for your comments.
I think you meant requiring `names` to be non-null but `lookup` may still be null. It's okay to change the spec to require `names` to be non-null.
Probably better to mention in `@param names` that `names` is ignored when the `methodName` is `equals` or `hashCode`.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5226
More information about the core-libs-dev
mailing list