On Thu, 17 Sep 2026 12:19:56 GMT, Jorn Vernee <[email protected]> wrote:

>> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 7726:
>> 
>>> 7724:     public static MethodHandle synchronize(MethodHandle body) {
>>> 7725:         Objects.requireNonNull(body);
>>> 7726:         return MethodHandleImpl.makeSynchronize(body.asFixedArity());
>> 
>> Should the returned handle be made variable arity when `body` has variable 
>> arity?
>
> I opted not to do this. A user can pretty easily use `asVarargsCollector` on 
> the result if they want

Most other methods that don't retain variable-arity have this note in the spec:

     * <em>Note:</em> The resulting adapter is never a {@linkplain 
MethodHandle#asVarargsCollector
     * variable-arity method handle}, even if the original target method handle 
was.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32817#discussion_r4037577117

Reply via email to