On Tue, 22 Mar 2022 12:56:02 GMT, Jim Laskey <[email protected]> wrote:
>> src/java.base/share/classes/java/lang/runtime/Carrier.java line 574:
>>
>>> 572: try {
>>> 573: Lookup lookup = MethodHandles.lookup();
>>> 574: return lookup.defineHiddenClass(bytes, false,
>>> ClassOption.STRONG);
>>
>> Actually, this lookup object should probably be kept cached.
>
> Which one, the context lookup or the hidden class lookup?
The context lookup used to define the hidden class, not the one returned. Don't
know how costly calling the caller sensitive `lookup()` is, if the calls are
too expensive then we'd rather cache it in a static final field
-------------
PR: https://git.openjdk.java.net/jdk/pull/7744