I discovered a possible gap in the MethodHandles API.
Say I want to create an exception handler that does nothing but ignore
the exception. The target handle is a method that looks like this:
void foo(String)
I have my "target" handle pointing at foo.
I want to catch all Throwable and ignore th
Hi Charly,
why not use Void and return null what behaves like using void as
the return type.
Cheers
Chris
Am 24.01.2012 08:01, schrieb Charles Oliver Nutter:
> I discovered a possible gap in the MethodHandles API.
>
> Say I want to create an exception handler that does nothing but
> ignore the
Oh, that does seem to work...what an ugly hack. And actually, you can
just use Object.class but cast the resulting return to void, and it
works.
So basically, I do this:
handler = MethodHandles.constant(Object.class, null)
handler = MethodHandles.asType(void.class)
handler = MethodHandles.dropArg