RFR: 8300237: Minor improvements in MethodHandles [v3]

Rémi Forax forax at openjdk.org
Tue Jan 17 20:54:19 UTC 2023


On Tue, 17 Jan 2023 18:07:37 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:
> 
>   Polishing

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

> 57: import java.nio.ByteOrder;
> 58: import java.security.ProtectionDomain;
> 59: import java.util.*;

oops

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

> 6745:                 .max(Comparator.comparing(MethodType::parameterCount))
> 6746:                 .map(MethodType::ptypes)
> 6747:                 .map(longest -> List.of(Arrays.copyOfRange(longest, skipSize, longest.length)))

i think you can fuse these to map() calls

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

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


More information about the core-libs-dev mailing list