Direct method handles to static methods
john.r.rose at oracle.com
Tue Aug 19 23:47:26 UTC 2014
On Aug 18, 2014, at 5:49 AM, Raffaello Giulietti <raffaello.giulietti at gmail.com> wrote:
> On 2014-08-18 14:45, Remi Forax wrote:
>> On 08/18/2014 12:19 PM, Raffaello Giulietti wrote:
>>> What happens to direct method handles to *static* methods when the
>>> underlying method implementation changes at runtime, for example by
>>> using java.lang.instrument transformations or redefinitions?
>>> Before doing some experiments, I would just like an authoritative answer.
>> It just works* :)
> You mean that the next invocation via the method handle executes the new code? Fantastic!
The basic design rule is that a method handle behaves like the corresponding invoke* (or get* or set*) bytecode.
Since those have the behavior you describe, so do the method handles.
(Class initialization rules are also respected, for the *static and constructor method handles. Caller-sensitive methods are caller-sensitive. Etc.)
If this basic design rule is violated, it is probably a bug in the implementation, not in the design.
More information about the mlvm-dev