On Tue, 2 Dec 2025 17:24:41 GMT, Chen Liang <[email protected]> wrote:
>> src/java.base/share/classes/java/lang/invoke/VarHandle.java line 2036:
>>
>>> 2034: var constant = MethodHandleImpl.isCompileConstant(vh);
>>> 2035: var cache = adaptedMh;
>>> 2036: if (constant == MethodHandleImpl.CONSTANT_YES && cache !=
>>> null) {
>>
>> Rookie question: Is there multi-thread considerations here? How about
>> visibility across threads?
>
> MethodHandle is immutable and can be safely published. So this is ok.
I meant that even though objects are immutable, plain semantics might not
always do.
Reference: https://shipilev.net/blog/2014/safe-public-construction/
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2584535309