void return type for foldArguments combiner
Kirill Shirokov
kirill.shirokov at oracle.com
Sat Mar 19 18:30:16 PDT 2011
Hi,
1. Can the combiner method in MethodHandles.foldArguments() have the void return type, so the combiner result is not passed to target?
This would allow to easily add a debugging hook (or aspect) to a MethodHandle call.
2. Can I apply MethodHandles.filterReturnValue() to a void target method to make the method return some value?
With the current implementation, to add a void "hook" to a method handle, it seems that I have to do the following:
target = MethodHandles.foldArguments(
MethodHandles.dropArguments(target, 0),
MethodHandles.convertArguments(hook, MethodType.methodType(int.class, target.parameterArray()))
)
Please correct me if I'm wrong.
Thanks in advance!
--Kirill
More information about the mlvm-dev
mailing list