Enum MethodInvocation
- All Implemented Interfaces:
Serializable
,Comparable<MethodInvocation>
,java.lang.constant.Constable
A builder for a method invocation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Performs a method invocation on a method handle with a polymorphic type signature.static enum
The type of method handle invocation.protected static enum
An illegal implicit method invocation.protected class
An implementation of a method invoking stack manipulation.protected static class
A method invocation of a generically resolved method.static interface
Represents a method invocation where the invocation type (static, virtual, special, interface) is derived from the given method's description.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAn interface-typed virtual method invocation.A private method call that is potentially virtual on an interface type.A specialized pseudo-virtual method invocation for a non-constructor.A specialized pseudo-virtual method invocation for a constructor.A static method invocation.A virtual method invocation.A private method call that is potentially virtual. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
The handle being used for a dynamic method invocation.private final int
The handle being used for a dynamic method invocation before Java 11.private final int
The opcode for invoking a method before Java 11.private final int
The opcode for invoking a method. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
MethodInvocation
(int opcode, int handle, int legacyOpcode, int legacyHandle) Creates a new type of method invocation. -
Method Summary
Modifier and TypeMethodDescriptioninvoke
(MethodDescription methodDescription) Creates a method invocation with an implicitly determined invocation type.invoke
(MethodDescription.InDefinedShape methodDescription) Creates a method invocation with an implicitly determined invocation type.static StackManipulation
lookup()
Returns a method invocation ofjava.lang.invoke.MethodHandles#lookup()
.static MethodInvocation
Returns the enum constant of this type with the specified name.static MethodInvocation[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
VIRTUAL
A virtual method invocation. -
INTERFACE
An interface-typed virtual method invocation. -
STATIC
A static method invocation. -
SPECIAL
A specialized pseudo-virtual method invocation for a non-constructor. -
SPECIAL_CONSTRUCTOR
A specialized pseudo-virtual method invocation for a constructor. -
VIRTUAL_PRIVATE
A private method call that is potentially virtual. -
INTERFACE_PRIVATE
A private method call that is potentially virtual on an interface type.
-
-
Field Details
-
opcode
private final int opcodeThe opcode for invoking a method. -
handle
private final int handleThe handle being used for a dynamic method invocation. -
legacyOpcode
private final int legacyOpcodeThe opcode for invoking a method before Java 11. -
legacyHandle
private final int legacyHandleThe handle being used for a dynamic method invocation before Java 11.
-
-
Constructor Details
-
MethodInvocation
private MethodInvocation(int opcode, int handle, int legacyOpcode, int legacyHandle) Creates a new type of method invocation.- Parameters:
opcode
- The opcode for invoking a method.handle
- The handle being used for a dynamic method invocation.legacyOpcode
- The opcode for invoking a method before Java 11.legacyHandle
- The handle being used for a dynamic method invocation before Java 11.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
invoke
public static MethodInvocation.WithImplicitInvocationTargetType invoke(MethodDescription.InDefinedShape methodDescription) Creates a method invocation with an implicitly determined invocation type.- Parameters:
methodDescription
- The method to be invoked.- Returns:
- A stack manipulation with implicitly determined invocation type.
-
invoke
public static MethodInvocation.WithImplicitInvocationTargetType invoke(MethodDescription methodDescription) Creates a method invocation with an implicitly determined invocation type. If the method's return type derives from its declared shape, the value is additionally casted to the value of the generically resolved method.- Parameters:
methodDescription
- The method to be invoked.- Returns:
- A stack manipulation with implicitly determined invocation type.
-
lookup
Returns a method invocation ofjava.lang.invoke.MethodHandles#lookup()
.- Returns:
- A method invocation for resolving the current lookup.
-