java.lang.Object
java.lang.constant.DynamicCallSiteDesc
public class DynamicCallSiteDesc extends Object
A nominal descriptor for an
invokedynamic
call site.
Concrete subtypes of DynamicCallSiteDesc must be value-based.
- Since:
- 12
-
Method Summary
Modifier and Type Method Description ConstantDesc[]
bootstrapArgs()
ReturnsConstantDesc
s describing the bootstrap arguments for theinvokedynamic
.MethodHandleDesc
bootstrapMethod()
Returns aMethodHandleDesc
describing the bootstrap method for theinvokedynamic
.boolean
equals(Object o)
Compares the specified object with this descriptor for equality.String
invocationName()
Returns the invocation name that would appear in theNameAndType
operand of theinvokedynamic
.MethodTypeDesc
invocationType()
Returns aMethodTypeDesc
describing the invocation type that would appear in theNameAndType
operand of theinvokedynamic
.static DynamicCallSiteDesc
of(DirectMethodHandleDesc bootstrapMethod, MethodTypeDesc invocationType)
Creates a nominal descriptor for aninvokedynamic
call site whose bootstrap method has no static arguments and for which the name parameter isConstantDescs.DEFAULT_NAME
.static DynamicCallSiteDesc
of(DirectMethodHandleDesc bootstrapMethod, String invocationName, MethodTypeDesc invocationType)
Creates a nominal descriptor for aninvokedynamic
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 aninvokedynamic
call site.CallSite
resolveCallSiteDesc(MethodHandles.Lookup lookup)
Reflectively invokes the bootstrap method with the specified arguments, and return the resultingCallSite
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 aninvokedynamic
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 aninvokedynamic
call site whose bootstrap and bootstrap arguments are the same as this one, but with the specified invocationName and invocation invocationType
-
Method Details
-
of
public static DynamicCallSiteDesc of(DirectMethodHandleDesc bootstrapMethod, String invocationName, MethodTypeDesc invocationType, ConstantDesc... bootstrapArgs)Creates a nominal descriptor for aninvokedynamic
call site.- Parameters:
bootstrapMethod
- aDirectMethodHandleDesc
describing the bootstrap method for theinvokedynamic
invocationName
- The unqualified name that would appear in theNameAndType
operand of theinvokedynamic
invocationType
- aMethodTypeDesc
describing the invocation type that would appear in theNameAndType
operand of theinvokedynamic
bootstrapArgs
-ConstantDesc
s describing the static arguments to the bootstrap, that would appear in theBootstrapMethods
attribute- Returns:
- the nominal descriptor
- Throws:
NullPointerException
- if any parameter is nullIllegalArgumentException
- 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 aninvokedynamic
call site whose bootstrap method has no static arguments.- Parameters:
bootstrapMethod
- The bootstrap method for theinvokedynamic
invocationName
- The invocationName that would appear in theNameAndType
operand of theinvokedynamic
invocationType
- The invocation invocationType that would appear in theNameAndType
operand of theinvokedynamic
- Returns:
- the nominal descriptor
- Throws:
NullPointerException
- if any parameter is nullIllegalArgumentException
- if the invocation name has the incorrect format
-
of
public static DynamicCallSiteDesc of(DirectMethodHandleDesc bootstrapMethod, MethodTypeDesc invocationType)Creates a nominal descriptor for aninvokedynamic
call site whose bootstrap method has no static arguments and for which the name parameter isConstantDescs.DEFAULT_NAME
.- Parameters:
bootstrapMethod
- aDirectMethodHandleDesc
describing the bootstrap method for theinvokedynamic
invocationType
- aMethodTypeDesc
describing the invocation type that would appear in theNameAndType
operand of theinvokedynamic
- Returns:
- the nominal descriptor
- Throws:
NullPointerException
- if any parameter is null
-
withArgs
Returns a nominal descriptor for aninvokedynamic
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 theBootstrapMethods
attribute- Returns:
- the nominal descriptor
- Throws:
NullPointerException
- if any parameter is null
-
withNameAndType
Returns a nominal descriptor for aninvokedynamic
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 theNameAndType
operand of theinvokedynamic
invocationType
- aMethodTypeDesc
describing the invocation type that would appear in theNameAndType
operand of theinvokedynamic
- Returns:
- the nominal descriptor
- Throws:
NullPointerException
- if any parameter is nullIllegalArgumentException
- if the invocation name has the incorrect format- See Java Virtual Machine Specification:
-
4.2.2 Unqualified Names
-
invocationName
Returns the invocation name that would appear in theNameAndType
operand of theinvokedynamic
.- Returns:
- the invocation name
-
invocationType
Returns aMethodTypeDesc
describing the invocation type that would appear in theNameAndType
operand of theinvokedynamic
.- Returns:
- the invocation type
-
bootstrapMethod
Returns aMethodHandleDesc
describing the bootstrap method for theinvokedynamic
.- Returns:
- the bootstrap method for the
invokedynamic
-
bootstrapArgs
ReturnsConstantDesc
s describing the bootstrap arguments for theinvokedynamic
. 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
Reflectively invokes the bootstrap method with the specified arguments, and return the resultingCallSite
- Parameters:
lookup
- TheMethodHandles.Lookup
used to resolve class names- Returns:
- the
CallSite
- Throws:
Throwable
- if any exception is thrown by the bootstrap method
-
equals
Compares the specified object with this descriptor for equality. Returnstrue
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 classObject
- Parameters:
o
- theDynamicCallSiteDesc
to compare to thisDynamicCallSiteDesc
- Returns:
true
if the specifiedDynamicCallSiteDesc
is equals to thisDynamicCallSiteDesc
.- See Also:
Object.hashCode()
,HashMap
-
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.
-