Use of condy + MH.invokevirtual instead of indy Was Deconstruction patterns
Brian Goetz
brian.goetz at oracle.com
Tue Mar 7 14:33:00 UTC 2023
> First, there is a small typo,
> invokevirtual MethodHandle::invoke(II)V
>
> should be
> invokevirtual MethodHandle::invoke(II)Ljava/lang/Object;
Good catch.
> I believe that indy is better than ldc condy + MH.invokevirtual because the main difference between these two approaches is that in the case of indy the bootstrap method receive the Lookup and I believe you need the Lookup at runtime (exactly the ClassLoader) to decode the field "patternDescr" of the attribute Matcher (to transform it to a MethodType).
Condy receives the Lookup as well (there is also an effort underway,
slowly, to make the metadata (Lookup/name/type) optional for condy, so
ordinary static methods can be used as bootstraps.) So this is not a
difference.
More information about the amber-spec-experts
mailing list