RFR: 8300237: Minor improvements in MethodHandles [v4]

Claes Redestad redestad at openjdk.org
Tue Jan 17 22:33:29 UTC 2023


On Tue, 17 Jan 2023 21:24:34 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:

>> - `MethodType.ptypes()` can be used instead of `MethodType.parameterList()` when we don't need a copy
>> - comparison of two lists can be done without `Stream.reduce()`
>
> Sergey Tsypanov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Merge map() calls

LGTM

src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 6752:

> 6750:                 .map(MethodHandle::type)
> 6751:                 .filter(t -> t.parameterCount() > skipSize)
> 6752:                 .max(Comparator.comparing(MethodType::parameterCount))

@forax suggested `Comparator.comparingInt` here, which may or may not help avoid some boxing.

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

Marked as reviewed by redestad (Reviewer).

PR: https://git.openjdk.org/jdk/pull/12025


More information about the core-libs-dev mailing list