# Class DynamicCallSiteDesc

java.lang.Object
java.lang.constant.DynamicCallSiteDesc

public final class DynamicCallSiteDesc extends Object
A nominal descriptor for an `invokedynamic` call site.

A `DynamicCallSiteDesc` is immutable and its behavior does not rely on object identity.

Since:
  12

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ConstantDesc[]`
  `bootstrapArgs()`
  Returns `ConstantDesc`s describing the bootstrap arguments for the `invokedynamic`.
  `MethodHandleDesc`
  `bootstrapMethod()`
  Returns a `MethodHandleDesc` describing the bootstrap method for the `invokedynamic`.
  `final boolean`
  `equals(Object o)`
  Compares the specified object with this descriptor for equality.
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `String`
  `invocationName()`
  Returns the invocation name that would appear in the `NameAndType` operand of the `invokedynamic`.
  `MethodTypeDesc`
  `invocationType()`
  Returns a `MethodTypeDesc` describing the invocation type that would appear in the `NameAndType` operand of the `invokedynamic`.
  `static DynamicCallSiteDesc`
  `of(DirectMethodHandleDesc bootstrapMethod, MethodTypeDesc invocationType)`
  Creates a nominal descriptor for an `invokedynamic` call site whose bootstrap method has no static arguments and for which the name parameter is `ConstantDescs.DEFAULT_NAME`.
  `static DynamicCallSiteDesc`
  `of(DirectMethodHandleDesc bootstrapMethod, String invocationName, MethodTypeDesc invocationType)`
  Creates a nominal descriptor for an `invokedynamic` call site whose bootstrap method has no static arguments.
  `static DynamicCallSiteDesc`
  `of(DirectMethodHandleDesc bootstrapMethod, String invocationName, MethodTypeDesc invocationType, ConstantDesc... bootstrapArgs)`
  Creates a nominal descriptor for an `invokedynamic` call site.
  `CallSite`
  `resolveCallSiteDesc(MethodHandles.Lookup lookup)`
  Reflectively invokes the bootstrap method with the specified arguments, and return the resulting `CallSite`
  `String`
  `toString()`
  Returns a compact textual description of this call site description, including the bootstrap method, the invocation name and type, and the static bootstrap arguments.
  `DynamicCallSiteDesc`
  `withArgs(ConstantDesc... bootstrapArgs)`
  Returns a nominal descriptor for an `invokedynamic` call site whose bootstrap method, name, and invocation type are the same as this one, but with the specified bootstrap arguments.
  `DynamicCallSiteDesc`
  `withNameAndType(String invocationName, MethodTypeDesc invocationType)`
  Returns a nominal descriptor for an `invokedynamic` call site whose bootstrap and bootstrap arguments are the same as this one, but with the specified invocationName and invocation invocationType

  ### Methods declared in class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Method Details

  - ### of

    public static DynamicCallSiteDesc of(DirectMethodHandleDesc bootstrapMethod, String invocationName, MethodTypeDesc invocationType, ConstantDesc... bootstrapArgs)
    Creates a nominal descriptor for an `invokedynamic` call site.
    Parameters:
      `bootstrapMethod` - a `DirectMethodHandleDesc` describing the bootstrap method for the `invokedynamic`
      `invocationName` - The unqualified name that would appear in the `NameAndType` operand of the `invokedynamic`
      `invocationType` - a `MethodTypeDesc` describing the invocation type that would appear in the `NameAndType` operand of the `invokedynamic`
      `bootstrapArgs` - `ConstantDesc`s describing the static arguments to the bootstrap, that would appear in the `BootstrapMethods` attribute
    Returns:
      the nominal descriptor
    Throws:
      `NullPointerException` - if any parameter or its contents are `null`
      `IllegalArgumentException` - if the invocation name has the incorrect format
    See Java Virtual Machine Specification:
      4.2.2 Unqualified Names

  - ### of

    public static DynamicCallSiteDesc of(DirectMethodHandleDesc bootstrapMethod, String invocationName, MethodTypeDesc invocationType)
    Creates a nominal descriptor for an `invokedynamic` call site whose bootstrap method has no static arguments.
    Parameters:
      `bootstrapMethod` - The bootstrap method for the `invokedynamic`
      `invocationName` - The invocationName that would appear in the `NameAndType` operand of the `invokedynamic`
      `invocationType` - The invocation invocationType that would appear in the `NameAndType` operand of the `invokedynamic`
    Returns:
      the nominal descriptor
    Throws:
      `NullPointerException` - if any parameter is null
      `IllegalArgumentException` - if the invocation name has the incorrect format

  - ### of

    public static DynamicCallSiteDesc of(DirectMethodHandleDesc bootstrapMethod, MethodTypeDesc invocationType)
    Creates a nominal descriptor for an `invokedynamic` call site whose bootstrap method has no static arguments and for which the name parameter is `ConstantDescs.DEFAULT_NAME`.
    Parameters:
      `bootstrapMethod` - a `DirectMethodHandleDesc` describing the bootstrap method for the `invokedynamic`
      `invocationType` - a `MethodTypeDesc` describing the invocation type that would appear in the `NameAndType` operand of the `invokedynamic`
    Returns:
      the nominal descriptor
    Throws:
      `NullPointerException` - if any parameter is null

  - ### withArgs

    public DynamicCallSiteDesc withArgs(ConstantDesc... bootstrapArgs)
    Returns a nominal descriptor for an `invokedynamic` call site whose bootstrap method, name, and invocation type are the same as this one, but with the specified bootstrap arguments.
    Parameters:
      `bootstrapArgs` - `ConstantDesc`s describing the static arguments to the bootstrap, that would appear in the `BootstrapMethods` attribute
    Returns:
      the nominal descriptor
    Throws:
      `NullPointerException` - if the argument or its contents are `null`

  - ### withNameAndType

    public DynamicCallSiteDesc withNameAndType(String invocationName, MethodTypeDesc invocationType)
    Returns a nominal descriptor for an `invokedynamic` call site whose bootstrap and bootstrap arguments are the same as this one, but with the specified invocationName and invocation invocationType
    Parameters:
      `invocationName` - The unqualified name that would appear in the `NameAndType` operand of the `invokedynamic`
      `invocationType` - a `MethodTypeDesc` describing the invocation type that would appear in the `NameAndType` operand of the `invokedynamic`
    Returns:
      the nominal descriptor
    Throws:
      `NullPointerException` - if any parameter is null
      `IllegalArgumentException` - if the invocation name has the incorrect format
    See Java Virtual Machine Specification:
      4.2.2 Unqualified Names

  - ### invocationName

    public String invocationName()
    Returns the invocation name that would appear in the `NameAndType` operand of the `invokedynamic`.
    Returns:
      the invocation name

  - ### invocationType

    public MethodTypeDesc invocationType()
    Returns a `MethodTypeDesc` describing the invocation type that would appear in the `NameAndType` operand of the `invokedynamic`.
    Returns:
      the invocation type

  - ### bootstrapMethod

    public MethodHandleDesc bootstrapMethod()
    Returns a `MethodHandleDesc` describing the bootstrap method for the `invokedynamic`.
    Returns:
      the bootstrap method for the `invokedynamic`

  - ### bootstrapArgs

    public ConstantDesc[] bootstrapArgs()
    Returns `ConstantDesc`s describing the bootstrap arguments for the `invokedynamic`. The returned array is always non-null. A zero length array is returned if this DynamicCallSiteDesc has no bootstrap arguments.
    Returns:
      the bootstrap arguments for the `invokedynamic`

  - ### resolveCallSiteDesc

    public CallSite resolveCallSiteDesc(MethodHandles.Lookup lookup) throws Throwable
    Reflectively invokes the bootstrap method with the specified arguments, and return the resulting `CallSite`
    Parameters:
      `lookup` - The `MethodHandles.Lookup` used to resolve class names
    Returns:
      the `CallSite`
    Throws:
      `Throwable` - if any exception is thrown by the bootstrap method

  - ### equals

    public final boolean equals(Object o)
    Compares the specified object with this descriptor for equality. Returns `true` if and only if the specified object is also a DynamicCallSiteDesc, and both descriptors have equal bootstrap methods, bootstrap argument lists, invocation name, and invocation type.
    Overrides:
      `equals` in class `Object`
    Parameters:
      `o` - the `DynamicCallSiteDesc` to compare to this `DynamicCallSiteDesc`
    Returns:
      `true` if the specified `DynamicCallSiteDesc` is equal to this `DynamicCallSiteDesc`.
    See Also:
      - `Object.hashCode()`
      - `HashMap`

  - ### hashCode

    public final int hashCode()
    Description copied from class: `Object`
    Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by `HashMap`.

    The general contract of `hashCode` is:

    - Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
    - If two objects are equal according to the `equals` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
    - It is not required that if two objects are unequal according to the `equals` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
    Overrides:
      `hashCode` in class `Object`
    Returns:
      a hash code value for this object
    See Also:
      - `Object.equals(java.lang.Object)`
      - `System.identityHashCode(Object)`

  - ### toString

    public String toString()
    Returns a compact textual description of this call site description, including the bootstrap method, the invocation name and type, and the static bootstrap arguments.
    Overrides:
      `toString` in class `Object`
    Returns:
      A compact textual description of this call site descriptor