-
CSR
-
Resolution: Approved
-
P3
-
None
-
behavioral
-
minimal
-
-
Java API, Other
Summary
Update the specification of MethodHandle.invokeWithArguments
to support an arity of more than 251 (referred to as jumbo-arity) if the method handle has variable arity with the trailing parameter, whereby additional arguments will be accumulated into an array of the appropriate type with appropriate asType conforming conversions.
Update the specification of bootstrap method invocation to invoke a bootstrap method handle with MethodHandle.invokeWithArguments
instead of MethodHandle.invoke
(the latter is equivalent to the former if the number of arguments is below the currently supported maximum limit).
Problem
Currently MethodHandle.invokeWithArguments
is limited to 251 arguments (255 - 1 - 3), where 4 arguments are reserved for the receiver, the lookup class, the name, and type. And MethodHandle.invoke
is also limited, naturally by VM limitations. This limits the number of (static) arguments that may declared by a bootstrap method of an invokedynamic
instruction and for the future dynamic constants (see JEP 309: Dynamic Class-File Constants, http://openjdk.java.net/jeps/309).
Solution
Remove the arity limitation for MethodHandle.invokeWithArguments
and specify bootstrap method invocation in terms of MethodHandle.invokeWithArguments
.
In addition it has proved to provide utility method on MethodType, MethodType.lastParameterType
, that is referred to in the specification.
Specification
See (and attached patch): http://cr.openjdk.java.net/~psandoz/jdk10/JDK-8185992-invoke-with-arguments-jumbo/webrev/
(I would add inline, but the patch renders incorrectly.)
- csr of
-
JDK-8185993 MethodHandle.invokeWithArguments jumbo-arity
- Resolved