I think I got it! MethodHandle result = MethodHandles.catchException(foo, postException); # handles exceptional path of finally and throws result = MethodHandles.foldArgments(postCall, result); # handles non-exceptional path of finally.
Am I right?! On Fri, Jun 10, 2011 at 7:12 PM, Charles Oliver Nutter <[email protected]> wrote: > I just posted your trick (a "duh" moment for me) to JVM-L, along with > an explanation of why it doesn't solve the try/finally problem. The > exceptional and non-exceptional paths need to be exclusive to match > what try/finally does. > > - Charlie > > On Fri, Jun 10, 2011 at 7:05 PM, Charles Oliver Nutter > <[email protected]> wrote: >> On Fri, Jun 10, 2011 at 6:55 PM, John Rose <[email protected]> wrote: >>> On Jun 10, 2011, at 4:39 PM, Charles Oliver Nutter wrote: >>> >>>> 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)! >>> >>> I think this does what you want: >>> >>> mh = foldArguments(postProcessor, mh); >> >> Yup, it's close, but see my other post just now to JVM-L. It's not >> possible to do two mutually-exclusive finally paths for both >> exceptional and non-exceptional. >> >> Am I wrong? >> >> - Charlie >> > _______________________________________________ mlvm-dev mailing list [email protected] http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
