MethodHandles.Lookup object on the caller
class in which the call site occurs, the dynamic operation at the call
site, and the method type of the call site. CallSiteDescriptor
objects are used in Dynalink to capture and store these parameters for
subsequent use by the DynamicLinker.
The constructors of built-in RelinkableCallSite implementations all
take a call site descriptor.
Call site descriptors must be immutable. You can use this class as-is or you can subclass it, especially if you need to add further information to the descriptors (typically, values passed in additional parameters to the bootstrap method. Since the descriptors must be immutable, you can set up a cache for equivalent descriptors to have the call sites share them.
The class extends SecureLookupSupplier to encapsulate the MethodHandles.Lookup object. This lookup should be used
to find method handles to set as targets of the call site described by this
descriptor.
| Modifier and Type | Field and Description |
|---|---|
| private final MethodType | |
| private final Operation |
| Access | Constructor and Description |
|---|---|
| public | CallSiteDescriptor(final MethodHandles.
the lookup object describing the class the call site belongs to.
When creating descriptors from a lookup,java. bootstrap method,
it should be the lookup passed to the bootstrap.the dynamic operation at the call site. operation, final MethodType the method type of the call site. When creating
descriptors from a methodType)java. bootstrap method, it should be
the method type passed to the bootstrap.Creates a new call site descriptor. |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| private void | |
| public final CallSiteDescriptor | Returns: a call site descriptor with changed method type.the new method type newMethodType)Finds or creates a call site descriptor that only differs in its method type from this descriptor. |
| protected CallSiteDescriptor | Returns: a call site descriptor with the changed method type.the new method type newMethodType)Finds or creates a call site descriptor that only differs in its method type from this descriptor. |
| public final CallSiteDescriptor | Returns: a call site descriptor with the changed operation.the new operation newOperation)Finds or creates a call site descriptor that only differs in its operation from this descriptor. |
| protected CallSiteDescriptor | Returns: a call site descriptor with the changed operation.the new operation newOperation)Finds or creates a call site descriptor that only differs in its operation from this descriptor. |
| public boolean | equals(final Object obj)
Overrides java. Returns true if this call site descriptor is equal to the passed object. |
| public final MethodType | Returns: type of the method at the call site.The type of the method at the call site. |
| public final Operation | |
| public int | Returns: value-based hash code for this call site descriptor.Overrides java. Returns a value-based hash code of this call site descriptor computed from its operation, method type, and lookup object's lookup class and lookup modes. |
| private static int | Returns: a hash code for the object..the lookup object. lookupReturns a value-based hash code for the passed lookup object. |
| private static boolean | Returns: true if the two lookups are equal, false otherwise.first lookup l1,second lookup l2Compares two lookup objects for value-based equality. |
| public String | toString()
Overrides java. Returns the string representation of this call site descriptor, of the
format |
| methodType | back to summary |
|---|---|
| private final MethodType methodType | |
| operation | back to summary |
|---|---|
| private final Operation operation | |
| CallSiteDescriptor | back to summary |
|---|---|
| public CallSiteDescriptor(final MethodHandles. Creates a new call site descriptor.
| |
| alwaysAssert | back to summary |
|---|---|
| private static void alwaysAssert(final boolean cond, final Supplier<String> errorMessage) | |
| assertChangeInvariants | back to summary |
|---|---|
| private void assertChangeInvariants(final CallSiteDescriptor changed, final String caller) | |
| changeMethodType | back to summary |
|---|---|
| public final CallSiteDescriptor changeMethodType(final MethodType newMethodType) Finds or creates a call site descriptor that only differs in its
method type from this descriptor.
Invokes
| |
| changeMethodTypeInternal | back to summary |
|---|---|
| protected CallSiteDescriptor changeMethodTypeInternal(final MethodType newMethodType) Finds or creates a call site descriptor that only differs in its
method type from this descriptor. Subclasses must override this method
to return an object of their exact class. If an overridden method changes
something other than the method type in the descriptor (its class, lookup,
or operation), or returns null, an
| |
| changeOperation | back to summary |
|---|---|
| public final CallSiteDescriptor changeOperation(final Operation newOperation) Finds or creates a call site descriptor that only differs in its
operation from this descriptor.
Invokes
| |
| changeOperationInternal | back to summary |
|---|---|
| protected CallSiteDescriptor changeOperationInternal(final Operation newOperation) Finds or creates a call site descriptor that only differs in its
operation from this descriptor. Subclasses must override this method
to return an object of their exact class. If an overridden method changes
something other than the operation in the descriptor (its class, lookup,
or method type), or returns null, an
| |
| equals | back to summary |
|---|---|
| public boolean equals(final Object obj) Overrides java. Returns true if this call site descriptor is equal to the passed object.
It is considered equal if the other object is of the exact same class,
their operations and method types are equal, and their lookups have the
same
| |
| getMethodType | back to summary |
|---|---|
| public final MethodType getMethodType() The type of the method at the call site.
| |
| getOperation | back to summary |
|---|---|
| public final Operation getOperation() Returns the operation at the call site.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns a value-based hash code of this call site descriptor computed from its operation, method type, and lookup object's lookup class and lookup modes.
| |
| lookupHashCode | back to summary |
|---|---|
| private static int lookupHashCode(final MethodHandles. Returns a value-based hash code for the passed lookup object. It is
based on the lookup object's
| |
| lookupsEqual | back to summary |
|---|---|
| private static boolean lookupsEqual(final MethodHandles. Compares two lookup objects for value-based equality. They are considered
equal if they have the same
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns the string representation of this call site descriptor, of the
format
| |