ConstantCallSite is a CallSite whose target is permanent, and can never be changed.
An invokedynamic instruction linked to a ConstantCallSite is permanently
bound to the call site's target.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private static final Unsafe |
| Access | Constructor and Description |
|---|---|
| public | ConstantCallSite(MethodHandle
the target to be permanently associated with this call site target)Creates a call site with a permanent target. |
| protected | ConstantCallSite(MethodType
the type of the method handle to be permanently associated with this call site targetType, MethodHandle a method handle to invoke (on the call site) to produce the call site's target createTargetHook)Creates a call site with a permanent target, possibly bound to the call site itself. |
| Modifier and Type | Method and Description |
|---|---|
| public final MethodHandle | Returns: the immutable linkage state of this call site, a constant method handleImplements abstract java. Returns this call site's permanent target. |
| public final MethodHandle | Returns: the immutable linkage state of this call site, a constant method handleImplements abstract java. Returns the target method of the call site, which behaves
like a |
| public final void | setTarget(MethodHandle
a new target proposed for the call site, which is ignored ignore)Implements abstract java. Always throws an |
| isFrozen | back to summary |
|---|---|
| private boolean isFrozen
| |
| UNSAFE | back to summary |
|---|---|
| private static final Unsafe UNSAFE | |
| ConstantCallSite | back to summary |
|---|---|
| public ConstantCallSite(MethodHandle target) Creates a call site with a permanent target.
| |
| ConstantCallSite | back to summary |
|---|---|
| protected ConstantCallSite(MethodType targetType, MethodHandle createTargetHook) throws Throwable Creates a call site with a permanent target, possibly bound to the call site itself.
During construction of the call site, the
Note that user code cannot perform such an action directly in a subclass constructor,
since the target must be fixed before the
The hook is said to bind the call site to a target method handle,
and a typical action would be The result returned by the hook must be a method handle of exactly the same type as the call site.
While the hook is being called, the new
| |
| dynamicInvoker | back to summary |
|---|---|
| public final MethodHandle dynamicInvoker() Implements abstract java. Returns this call site's permanent target.
Since that target will never change, this is a correct implementation
of
| |
| getTarget | back to summary |
|---|---|
| public final MethodHandle getTarget() Implements abstract java. Returns the target method of the call site, which behaves
like a
| |
| setTarget | back to summary |
|---|---|
| public final void setTarget(MethodHandle ignore) Implements abstract java. Always throws an
| |