RFR: 8260605: Various java.lang.invoke cleanups [v6]

Claes Redestad redestad at openjdk.java.net
Wed Mar 17 18:04:49 UTC 2021


On Mon, 15 Mar 2021 18:27:04 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Mandy review + additional cleanup
>
> src/java.base/share/classes/java/lang/invoke/MethodType.java line 418:
> 
>> 416:     public MethodType changeParameterType(int num, Class<?> nptype) {
>> 417:         if (parameterType(num) == nptype)  return this;
>> 418:         checkPtype(nptype);
> 
> `nptype` is never void but  what  about the check if `nptype` is not null?

Other methods that delegate to `makeImpl` aren't doing up-front validation, so this change was made to get things more in line. It might be good to spell out that `makeImpl` does these checks for all its callers, though. (The `makeImpl` fast-path that execute before the validation can never return an invalid MethodType)

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

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


More information about the core-libs-dev mailing list