IMPORTANT: Missing feature in MethodHandles?

Charles Oliver Nutter headius at headius.com
Fri Jun 10 16:39:20 PDT 2011


Please, please have a look at my recent threads on JVM-L. I am worried
I've found a major hole in what MethodHandles can do. Specifically,
there's no way to post-process a given handle, receiving both its
arguments and its return value and deciding what to do, for something
like this try/finally form:

void foo(Object arg) {
  try {
    return someCall(arg);
  } finally {
    postProcess(arg);
  }
}

catchException allows me to post-process in *exceptional*
circumstances, but does not allow post-processing in *normal*
circumstances. That's the other half of the try/finally coin, and it
seems to be missing.

Please tell me I'm wrong, or tell me that we can modify catchException
in some way to also allow post-processing of non-exceptional results
(with return value inserted where the Throwable would go)!

- Charlie


More information about the mlvm-dev mailing list