Re: RFR: 8300237: Minor improvements in MethodHandles [v2]

2023-01-17 Thread Sergey Tsypanov
> - `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:

  Simplify

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/12025/files
  - new: https://git.openjdk.org/jdk/pull/12025/files/e9e0baa0..6d1397c4

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12025&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12025&range=00-01

  Stats: 6 lines in 1 file changed: 1 ins; 2 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/12025.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12025/head:pull/12025

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


Re: RFR: 8300237: Minor improvements in MethodHandles [v2]

2023-01-17 Thread RĂ©mi Forax
On Tue, 17 Jan 2023 10:18:42 GMT, Claes Redestad  wrote:

>> Using lambdas inside MethodHandles is quite dangerous given that lambdas are 
>> initialized using method handles. It may work now because 
>> longuestParameterList() is not called when initializing a lambda but it may 
>> make any changes in the implementation of lambdas painfull in the future.
>
> Precious little method handle use in lambda bootstrap since JDK 11. Though I 
> agree with the sentiment - having fixed a number of bootstrap issues in the 
> past - `MethodHandles` is a small step up the abstraction ladder and the code 
> in particular already uses a number of method refs and lambdas.

ok, two small changes,
-  formatting: usually the method call in a stream are aligned with the '.' at 
the beginning
```
 stream
   .filter(...)
  .map(...)
   ```
   instead of at the end.

- the reduce is a max(),
  `max(Comparator.comparingInt(List::size))`

-

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