Method references to same instance+method yield different method reference instances

John Rose john.r.rose at oracle.com
Wed Jan 22 12:30:24 PST 2014


On Jan 20, 2014, at 10:34 AM, Timo Kinnunen <timo.kinnunen at gmail.com> wrote:

> why the JVM links two identical invokedynamic instructions separately I don’t know


http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/tip/src/share/classes/java/lang/invoke/package-info.java
 * In an application which requires dynamic call sites with individually
 * mutable behaviors, their bootstrap methods should produce distinct
 * {@link java.lang.invoke.CallSite CallSite} objects, one for each linkage request.
 * Alternatively, an application can link a single {@code CallSite} object
 * to several {@code invokedynamic} instructions, in which case
 * a change to the target method will become visible at each of
 * the instructions.

It's a user choice, actually.  But that choice doesn't change Remi's observation about caching.

— John


More information about the lambda-dev mailing list