Top Description Fields Constructors Methods
java.lang.invoke

pack-priv final Class LazyInitializingVarHandle

extends VarHandle
Class Inheritance
Imports
jdk.internal.vm.annotation.ForceInline, .Stable, java.util.Optional

A lazy initializing var handle. It lazily initializes the referenced class before any invocation of the target var handle to prevent reading uninitialized static field values.

Field Summary

Modifier and TypeField and Description
private boolean
private static MethodHandle
private final Class<?>
private final VarHandle
Inherited from java.lang.invoke.VarHandle:
exactmethodHandleTablemethodTypeTablevform

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv MethodType
pack-priv VarHandle
asDirect()

Overrides java.lang.invoke.VarHandle.asDirect.

Returns the direct target VarHandle.

public Optional<VarHandle.VarHandleDesc>
describeConstable()

Overrides java.lang.invoke.VarHandle.describeConstable.

Implements java.lang.constant.Constable.describeConstable.

Return a nominal descriptor for this instance, if one can be constructed, or an empty Optional if one cannot be.

private void
private static MethodHandle
public MethodHandle
getMethodHandleUncached(int accessMode)

Overrides java.lang.invoke.VarHandle.getMethodHandleUncached.

Computes a method handle that can be passed the direct var handle of this var handle with the given access mode.

private void
pack-priv VarHandle
target()

Overrides java.lang.invoke.VarHandle.target.

Returns the target VarHandle.

public VarHandle
withInvokeBehavior()

Implements abstract java.lang.invoke.VarHandle.withInvokeBehavior.

Returns a VarHandle, with access to the same variable(s) as this VarHandle, but whose invocation behavior of access mode methods is adjusted to invoke behavior.

public VarHandle
withInvokeExactBehavior()

Implements abstract java.lang.invoke.VarHandle.withInvokeExactBehavior.

Returns a VarHandle, with access to the same variable(s) as this VarHandle, but whose invocation behavior of access mode methods is adjusted to invoke-exact behavior.

Inherited from java.lang.invoke.VarHandle:
accessModeTypeaccessModeTypeaccessModeTypeUncachedacquireFencecheckAccessModeThenIsDirectcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetcoordinateTypesfullFencegetgetAcquiregetAndAddgetAndAddAcquiregetAndAddReleasegetAndBitwiseAndgetAndBitwiseAndAcquiregetAndBitwiseAndReleasegetAndBitwiseOrgetAndBitwiseOrAcquiregetAndBitwiseOrReleasegetAndBitwiseXorgetAndBitwiseXorAcquiregetAndBitwiseXorReleasegetAndSetgetAndSetAcquiregetAndSetReleasegetMethodHandlegetOpaquegetVolatilehasInvokeExactBehaviorisAccessModeSupportedloadLoadFencereleaseFencesetsetOpaquesetReleasesetVolatilestoreStoreFencetoMethodHandletoStringupdateVarFormvarTypeweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetRelease

Field Detail

initializedback to summary
private boolean initialized
Annotations
@Stable
MH_ensureInitializedback to summary
private static MethodHandle MH_ensureInitialized
Annotations
@Stable
refcback to summary
private final Class<?> refc
targetback to summary
private final VarHandle target

Constructor Detail

LazyInitializingVarHandleback to summary
pack-priv LazyInitializingVarHandle(VarHandle target, Class<?> refc)

Method Detail

accessModeTypeUncachedback to summary
pack-priv MethodType accessModeTypeUncached(VarHandle.AccessType at)

Implements abstract java.lang.invoke.VarHandle.accessModeTypeUncached.

Annotations
@Override
asDirectback to summary
pack-priv VarHandle asDirect()

Overrides java.lang.invoke.VarHandle.asDirect.

Doc from java.lang.invoke.VarHandle.asDirect.

Returns the direct target VarHandle. Indirect VarHandle subclasses should implement this method.

Annotations
@Override
@ForceInline
describeConstableback to summary
public Optional<VarHandle.VarHandleDesc> describeConstable()

Overrides java.lang.invoke.VarHandle.describeConstable.

Implements java.lang.constant.Constable.describeConstable.

Doc from java.lang.invoke.VarHandle.describeConstable.

Return a nominal descriptor for this instance, if one can be constructed, or an empty Optional if one cannot be.

Returns:Optional<VarHandle.VarHandleDesc>

An Optional containing the resulting nominal descriptor, or an empty Optional if one cannot be constructed.

Annotations
@Override
ensureInitializedback to summary
private void ensureInitialized()
Annotations
@ForceInline
ensureInitializedMhback to summary
private static MethodHandle ensureInitializedMh()
getMethodHandleUncachedback to summary
public MethodHandle getMethodHandleUncached(int accessMode)

Overrides java.lang.invoke.VarHandle.getMethodHandleUncached.

Doc from java.lang.invoke.VarHandle.getMethodHandleUncached.

Computes a method handle that can be passed the direct var handle of this var handle with the given access mode. Pre/postprocessing such as argument or return value filtering should be done by the returned method handle.

Annotations
@Override
initializeback to summary
private void initialize()
targetback to summary
pack-priv VarHandle target()

Overrides java.lang.invoke.VarHandle.target.

Doc from java.lang.invoke.VarHandle.target.

Returns the target VarHandle. Subclasses may override this method to implement additional logic for example lazily initializing the declaring class of a static field var handle.

Annotations
@Override
@ForceInline
withInvokeBehaviorback to summary
public VarHandle withInvokeBehavior()

Implements abstract java.lang.invoke.VarHandle.withInvokeBehavior.

Doc from java.lang.invoke.VarHandle.withInvokeBehavior.

Returns a VarHandle, with access to the same variable(s) as this VarHandle, but whose invocation behavior of access mode methods is adjusted to invoke behavior.

If this VarHandle already has invoke behavior this VarHandle is returned.

Invoking hasInvokeExactBehavior() on the returned var handle is guaranteed to return false.

Returns:VarHandle

a VarHandle with invoke behavior

Annotations
@Override
withInvokeExactBehaviorback to summary
public VarHandle withInvokeExactBehavior()

Implements abstract java.lang.invoke.VarHandle.withInvokeExactBehavior.

Doc from java.lang.invoke.VarHandle.withInvokeExactBehavior.

Returns a VarHandle, with access to the same variable(s) as this VarHandle, but whose invocation behavior of access mode methods is adjusted to invoke-exact behavior.

If this VarHandle already has invoke-exact behavior this VarHandle is returned.

Invoking hasInvokeExactBehavior() on the returned var handle is guaranteed to return true.

Returns:VarHandle

a VarHandle with invoke-exact behavior

Annotations
@Override