IMPORTANT: Missing feature in MethodHandles?

Charles Oliver Nutter headius at headius.com
Fri Jun 10 17:27:54 PDT 2011


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
<headius at headius.com> 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
> <headius at headius.com> wrote:
>> On Fri, Jun 10, 2011 at 6:55 PM, John Rose <john.r.rose at oracle.com> 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
>>
>


More information about the mlvm-dev mailing list