I'm also trying to figure out a way to do the following sorts of logic
using only MethodHandle transformations:

void blah(Object arg1, Object arg2) {
  pre(arg1, arg2);
  try {
    return someOtherCall(arg1, arg2);
  } finally {
    post(arg1, arg2);
  }
}

The pre logic isn't hard; I think you can do a foldArguments that
returns void, and nothing gets re-inserted into the argument list.

The post logic is another story. I can handle the finally in general
with MethodHandles.catchException, but I can't call post() and then
continue to propagate the return value of someOtherCall(). Even worse,
because of the issue in my other thread, I can't insert a
non-exceptional call to post() after someOtherCall() if it needs to
receive arguments (because filterReturn doesn't get arguments).

I'm worried I've found a hole in the capabilities of method handles,
since as far as I can tell there's no way to wrap a call and do both
pre *and* post-processing with the incoming arguments.

- Charlie

-- 
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to jvm-languages@googlegroups.com.
To unsubscribe from this group, send email to 
jvm-languages+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.

Reply via email to