Question About MethodHandles.findSpecial
Fredrik Öhrström
fredrik.ohrstrom at oracle.com
Tue May 5 22:48:24 PDT 2009
John Rose skrev:
> On May 5, 2009, at 12:25 PM, Fredrik Öhrström wrote:
>
>
>>> or invocation of private methods, see section 7.7 of the JVM spec.
>>> Rémi
>>>
>> Thanks! A MethodHandle pointing to a private method makes sense.
>> Still the javadoc for findSpecial explicitly mentions the
>> constructor so
>> is there any reason for executing a constructor through a
>> MethodHandle?
>>
>
> Well, there is a strong reason for method invocation via
> invokespecial. To avoid burdensome workarounds, you need it if your
> dynamic language is going to extend Java classes. The topic was
> discussed on jvm-languages:
> http://groups.google.com/group/jvm-languages/browse_thread/thread/319982bfe1be9487/
>
>
I do not doubt that findSpecial is useful for a lot of reasons,
but I was asking about the constructor call. The javadoc says:
Produce an early-bound method handle for
a virtual method, or a handle for a constructor,
as if called from an |invokespecial| instruction from |caller|.
So my question was, and still is, :-) , why would you
call a constructor through a MethodHandle?
//Fredrik
More information about the mlvm-dev
mailing list