On Fri, 5 May 2023 13:03:14 GMT, Chen Liang <li...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/invoke/IndirectVarHandle.java line 74: >> >>> 72: @Override >>> 73: public boolean isAccessModeSupported(AccessMode accessMode) { >>> 74: var directTarget = this.directTarget; >> >> Why is this not defined in the superclass, and then use `asDirect` (as done >> in other cases) ? > > I aim to avoid eager evaluation of directTarget (which is lazy in > LazyStaticVarHandle, computing it requires initializing the holder class). > This code path checks a stable field, so it should allow constant-folding > when the direct target is available. I see - so, since this is just a "query" you would like to avoid initialization just for this. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13821#discussion_r1186079374