GuardingDynamicLinker#getGuardedInvocation(LinkRequest, LinkerServices)
and
GuardingTypeConverterFactory#convertToType(Class, Class, Supplier).
It is an immutable tuple of an invocation method handle, a guard method
handle that defines the applicability of the invocation handle, zero or more
switch points that can be used for external invalidation of the invocation
handle, and an exception type that if thrown during an invocation of the
method handle also invalidates it. The invocation handle is suitable for
invocation if the guard handle returns true for its arguments, and as long
as any of the switch points are not invalidated, and as long as it does not
throw an exception of the designated type. The guard, the switch points, and
the exception type are all optional (a guarded invocation having none of them
is unconditionally valid).
| Modifier and Type | Field and Description |
|---|---|
| private final Class | |
| private final MethodHandle | |
| private final MethodHandle | |
| private final SwitchPoint[] |
| Access | Constructor and Description |
|---|---|
| public | GuardedInvocation(final MethodHandle
the method handle representing the invocation. Must not
be null. invocation)Creates a new unconditional guarded invocation. |
| public | GuardedInvocation(final MethodHandle
the method handle representing the invocation. Must not
be null. invocation, final MethodHandle the method handle representing the guard. Must have be
compatible with the guard)invocation handle as per
MethodHandles#guardWithTest(MethodHandle, MethodHandle, MethodHandle).
For some useful guards, check out the Guards class. It can be
null to represent an unconditional invocation.Creates a new guarded invocation, with a guard method handle. |
| public | GuardedInvocation(final MethodHandle
the method handle representing the invocation. Must
not be null. invocation, final SwitchPoint the optional switch point that can be used to
invalidate this linkage. It can be null. If it is null, this represents
an unconditional invocation. switchPoint)Creates a new guarded invocation that can be invalidated by a switch point. |
| public | GuardedInvocation(final MethodHandle
the method handle representing the invocation. Must
not be null. invocation, final MethodHandle the method handle representing the guard. Must have be
compatible with the guard, final SwitchPoint invocation handle as per
MethodHandles#guardWithTest(MethodHandle, MethodHandle, MethodHandle).
For some useful guards, check out the Guards class. It can be
null. If both it and the switch point are null, this represents an
unconditional invocation.the optional switch point that can be used to
invalidate this linkage. switchPoint)Creates a new guarded invocation, with both a guard method handle and a switch point that can be used to invalidate it. |
| public | GuardedInvocation(final MethodHandle
the method handle representing the invocation. Must not
be null. invocation, final MethodHandle the method handle representing the guard. Must have be
compatible with the guard, final SwitchPoint invocation handle as per
MethodHandles#guardWithTest(MethodHandle, MethodHandle, MethodHandle).
For some useful guards, check out the Guards class. It can be
null. If it and the switch point and the exception are all null, this
represents an unconditional invocation.the optional switch point that can be used to
invalidate this linkage. switchPoint, final Class<? extends Throwable> the optional exception type that is when thrown by the
invocation also invalidates it. exception)Creates a new guarded invocation, with a guard method handle, a switch point that can be used to invalidate it, and an exception that if thrown when invoked also invalidates it. |
| public | GuardedInvocation(final MethodHandle
the method handle representing the invocation. Must not
be null. invocation, final MethodHandle the method handle representing the guard. Must have be
compatible with the guard, final SwitchPoint[] invocation handle as per
MethodHandles#guardWithTest(MethodHandle, MethodHandle, MethodHandle).
For some useful guards, check out the Guards class. It can be
null. If it and the exception are both null, and no switch points were
specified, this represents an unconditional invocation.optional switch points that can be used to
invalidate this linkage. switchPoints, final Class<? extends Throwable> the optional exception type that is when thrown by the
invocation also invalidates it. exception)Creates a new guarded invocation, with a guard method handle, any number of switch points that can be used to invalidate it, and an exception that if thrown when invoked also invalidates it. |
| Modifier and Type | Method and Description |
|---|---|
| public GuardedInvocation | Returns: a guarded invocation with the added switch point.new switch point. Can be null in which case this
method return the current guarded invocation with no changes. newSwitchPoint)Create a new guarded invocation with an added switch point. |
| public GuardedInvocation | Returns: a guarded invocation with the new type applied to it.the new type of the invocation. newType)Changes the type of the invocation, as if
|
| public GuardedInvocation | Returns: a guarded invocation with the new type applied to it.the linker services to use for the conversion linkerServices, final MethodType the new type of the invocation. newType)Changes the type of the invocation, as if
|
| public GuardedInvocation | Returns: a guarded invocation with the new type applied to it.a call descriptor whose method type is adapted. desc)Changes the type of the invocation, as if
|
| public GuardedInvocation | Returns: a guarded invocation with the new type applied to it.the linker services to use for the conversion linkerServices, final MethodType the new type of the invocation. newType)Changes the type of the invocation, as if
|
| public MethodHandle | Returns: a composite method handle.the fallback method handle for when a switch point is
invalidated, a guard returns false, or invalidating exception is thrown. fallback)Composes the invocation, guard, switch points, and the exception into a composite method handle that knows how to fall back when the guard fails or the invocation is invalidated. |
| public MethodHandle | Returns: a composite method handle.the fallback method handle in case guard returns
false. guardFallback, final MethodHandle the fallback method handle in case a switch
point is invalidated. switchpointFallback, final MethodHandle the fallback method in case the exception handler
triggers. catchFallback)Composes the invocation, guard, switch points, and the exception into a composite method handle that knows how to fall back when the guard fails or the invocation is invalidated. |
| public GuardedInvocation | Returns: an invocation that drops argumentsthe position of the first argument being dropped pos, final List<Class<?>> the types of the values being dropped valueTypes)Makes an invocation that drops arguments in both the invocation and the
guard (if it exists and has at least |
| public GuardedInvocation | Returns: an invocation that drops argumentsthe position of the first argument being dropped pos, final Class<?>... the types of the values being dropped valueTypes)Makes an invocation that drops arguments in both the invocation and the
guard (if it exists and has at least |
| public GuardedInvocation | Returns: a filtered invocationthe position of the first argument being filtered pos, final MethodHandle... the argument filters filters)Applies argument filters to both the invocation and the guard
(if it exists and has at least |
| public Class | Returns: the exception type that if thrown should be used to invalidate the linkage. Can be null.Returns the exception type that if thrown by the invocation should invalidate the linkage of this guarded invocation. |
| public MethodHandle | |
| public MethodHandle | Returns: the invocation method handle. It will never be null.Returns the invocation method handle. |
| public SwitchPoint[] | Returns: the switch points that can be used to invalidate the linkage of this invocation handle. Can be null.Returns the switch points that can be used to invalidate the linkage of this invocation handle. |
| public boolean | Returns: true if and only if this guarded invocation has at least one invalidated switch point.Returns true if and only if this guarded invocation has at least one invalidated switch point. |
| public GuardedInvocation | Returns: a new guarded invocation with the replaced methods and the same switch point as this invocation.the new invocation newInvocation, final MethodHandle the new guard newGuard)Creates a new guarded invocation with different methods, preserving the switch point. |
| private GuardedInvocation |
| exception | back to summary |
|---|---|
| private final Class<? extends Throwable> exception | |
| guard | back to summary |
|---|---|
| private final MethodHandle guard | |
| invocation | back to summary |
|---|---|
| private final MethodHandle invocation | |
| switchPoints | back to summary |
|---|---|
| private final SwitchPoint[] switchPoints | |
| GuardedInvocation | back to summary |
|---|---|
| public GuardedInvocation(final MethodHandle invocation) Creates a new unconditional guarded invocation. It is unconditional as it has no invalidations.
| |
| GuardedInvocation | back to summary |
|---|---|
| public GuardedInvocation(final MethodHandle invocation, final MethodHandle guard) Creates a new guarded invocation, with a guard method handle.
| |
| GuardedInvocation | back to summary |
|---|---|
| public GuardedInvocation(final MethodHandle invocation, final SwitchPoint switchPoint) Creates a new guarded invocation that can be invalidated by a switch point.
| |
| GuardedInvocation | back to summary |
|---|---|
| public GuardedInvocation(final MethodHandle invocation, final MethodHandle guard, final SwitchPoint switchPoint) Creates a new guarded invocation, with both a guard method handle and a switch point that can be used to invalidate it.
| |
| GuardedInvocation | back to summary |
|---|---|
| public GuardedInvocation(final MethodHandle invocation, final MethodHandle guard, final SwitchPoint switchPoint, final Class<? extends Throwable> exception) Creates a new guarded invocation, with a guard method handle, a switch point that can be used to invalidate it, and an exception that if thrown when invoked also invalidates it.
| |
| GuardedInvocation | back to summary |
|---|---|
| public GuardedInvocation(final MethodHandle invocation, final MethodHandle guard, final SwitchPoint[] switchPoints, final Class<? extends Throwable> exception) Creates a new guarded invocation, with a guard method handle, any number of switch points that can be used to invalidate it, and an exception that if thrown when invoked also invalidates it.
| |
| addSwitchPoint | back to summary |
|---|---|
| public GuardedInvocation addSwitchPoint(final SwitchPoint newSwitchPoint) Create a new guarded invocation with an added switch point.
| |
| asType | back to summary |
|---|---|
| public GuardedInvocation asType(final MethodType newType) Changes the type of the invocation, as if
| |
| asType | back to summary |
|---|---|
| public GuardedInvocation asType(final LinkerServices linkerServices, final MethodType newType) Changes the type of the invocation, as if
| |
| asType | back to summary |
|---|---|
| public GuardedInvocation asType(final CallSiteDescriptor desc) Changes the type of the invocation, as if
| |
| asTypeSafeReturn | back to summary |
|---|---|
| public GuardedInvocation asTypeSafeReturn(final LinkerServices linkerServices, final MethodType newType) Changes the type of the invocation, as if
| |
| compose | back to summary |
|---|---|
| public MethodHandle compose(final MethodHandle fallback) Composes the invocation, guard, switch points, and the exception into a composite method handle that knows how to fall back when the guard fails or the invocation is invalidated.
| |
| compose | back to summary |
|---|---|
| public MethodHandle compose(final MethodHandle guardFallback, final MethodHandle switchpointFallback, final MethodHandle catchFallback) Composes the invocation, guard, switch points, and the exception into a composite method handle that knows how to fall back when the guard fails or the invocation is invalidated.
| |
| dropArguments | back to summary |
|---|---|
| public GuardedInvocation dropArguments(final int pos, final List<Class<?>> valueTypes) Makes an invocation that drops arguments in both the invocation and the
guard (if it exists and has at least
| |
| dropArguments | back to summary |
|---|---|
| public GuardedInvocation dropArguments(final int pos, final Class<?>... valueTypes) Makes an invocation that drops arguments in both the invocation and the
guard (if it exists and has at least
| |
| filterArguments | back to summary |
|---|---|
| public GuardedInvocation filterArguments(final int pos, final MethodHandle... filters) Applies argument filters to both the invocation and the guard
(if it exists and has at least
| |
| getException | back to summary |
|---|---|
| public Class Returns the exception type that if thrown by the invocation should invalidate the linkage of this guarded invocation. | |
| getGuard | back to summary |
|---|---|
| public MethodHandle getGuard() Returns the guard method handle.
| |
| getInvocation | back to summary |
|---|---|
| public MethodHandle getInvocation() Returns the invocation method handle.
| |
| getSwitchPoints | back to summary |
|---|---|
| public SwitchPoint[] getSwitchPoints() Returns the switch points that can be used to invalidate the linkage of this invocation handle.
| |
| hasBeenInvalidated | back to summary |
|---|---|
| public boolean hasBeenInvalidated() Returns true if and only if this guarded invocation has at least one invalidated switch point.
| |
| replaceMethods | back to summary |
|---|---|
| public GuardedInvocation replaceMethods(final MethodHandle newInvocation, final MethodHandle newGuard) Creates a new guarded invocation with different methods, preserving the switch point.
| |
| replaceMethodsOrThis | back to summary |
|---|---|
| private GuardedInvocation replaceMethodsOrThis(final MethodHandle newInvocation, final MethodHandle newGuard) | |