Specifically, execution proceeds as if by the following steps, although the methods are not guaranteed to be called if the JVM can predict their effects.
Because of the action of the {@code asType} step, the following argumentconversions are applied as necessary:
The result returned by the call is boxed if it is a primitive, or forced to null if the return type is void.
This call is equivalent to the following code:
{@code MethodHandle invoker = MethodHandles.spreadInvoker(this.type(), 0); Object result = invoker.invokeExact(this, arguments);}
Unlike the signature polymorphic methods {@code invokeExact} and {@code invoke}, {@code invokeWithArguments} can be accessed normally via the Core Reflection API and JNI.It can therefore be used as a bridge between native or reflective code and method handles. @param arguments the arguments to pass to the target @return the result returned by the target @throws ClassCastException if an argument cannot be converted by reference casting @throws WrongMethodTypeException if the target's type cannot be adjusted to take the given number of {@code Object} arguments @throws Throwable anything thrown by the target method invocation @see MethodHandles#spreadInvoker
|
|