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

    




_______________________________________________
mlvm-dev mailing list
[email protected]
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to