On Thu, 18 Jun 2026 14:55:13 GMT, Chen Liang <[email protected]> wrote:

>> src/java.base/share/classes/java/lang/invoke/VarHandles.java line 163:
>> 
>>> 161:         }
>>> 162:         else if (type == boolean.class) {
>>> 163:             return maybeAdapt(f.isFinal() && 
>>> !isWriteAllowedOnFinalFields
>> 
>> Shouldn't we keep the `maybeAdapt` here? It's used for testing indirect var 
>> handles.
>
> It destroys the StaticFieldVarHandle type. I think keeping that type through 
> so LazyInitializingVarHandle can use attributes from StaticFieldVarHandle is 
> more valuable.

The `maybeAdapt` call happens in `makeFieldHandle`, passing the wrapping 
`LazyInitializingVarHandle` or the target handle if the class is fully 
initialised.

-------------

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2550#discussion_r3436975794

Reply via email to