Class MethodInvocation.Invocation
java.lang.Object
net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase
net.bytebuddy.implementation.bytecode.member.MethodInvocation.Invocation
- All Implemented Interfaces:
MethodInvocation.WithImplicitInvocationTargetType,StackManipulation
- Enclosing class:
MethodInvocation
@Enhance(includeSyntheticFields=true)
protected class MethodInvocation.Invocation
extends StackManipulation.AbstractBase
implements MethodInvocation.WithImplicitInvocationTargetType
An implementation of a method invoking stack manipulation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bytecode.StackManipulation
StackManipulation.AbstractBase, StackManipulation.Compound, StackManipulation.Illegal, StackManipulation.Simple, StackManipulation.Size, StackManipulation.Trivial -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MethodDescription.InDefinedShapeThe type on which this method is to be invoked.private final TypeDescriptionThe method to be invoked. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInvocation(MethodDescription.InDefinedShape methodDescription) Creates an invocation of a given method on its declaring type as an invocation target.protectedInvocation(MethodDescription.InDefinedShape methodDescription, TypeDescription typeDescription) Creates an invocation of a given method on a given invocation target type. -
Method Summary
Modifier and TypeMethodDescriptionapply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext) Applies the stack manipulation that is described by this instance.dynamic(String methodName, TypeDescription returnType, List<? extends TypeDescription> methodType, List<? extends JavaConstant> arguments) Invokes the method as a bootstrap method to bind a call site with the given properties.Invokes the method via aMethodHandle.special(TypeDescription invocationTarget) Transforms this method invocation into a special invocation on the given type.virtual(TypeDescription invocationTarget) Transforms this method invocation into a virtual (or interface) method invocation on the given type.Methods inherited from class net.bytebuddy.implementation.bytecode.StackManipulation.AbstractBase
isValidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.bytebuddy.implementation.bytecode.StackManipulation
isValid
-
Field Details
-
typeDescription
The method to be invoked. -
methodDescription
The type on which this method is to be invoked.
-
-
Constructor Details
-
Invocation
Creates an invocation of a given method on its declaring type as an invocation target.- Parameters:
methodDescription- The method to be invoked.
-
Invocation
protected Invocation(MethodDescription.InDefinedShape methodDescription, TypeDescription typeDescription) Creates an invocation of a given method on a given invocation target type.- Parameters:
methodDescription- The method to be invoked.typeDescription- The type on which this method is to be invoked.
-
-
Method Details
-
apply
public StackManipulation.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext) Applies the stack manipulation that is described by this instance.- Specified by:
applyin interfaceStackManipulation- Parameters:
methodVisitor- The method visitor used to write the method implementation to.implementationContext- The context of the current implementation.- Returns:
- The changes to the size of the operand stack that are implied by this stack manipulation.
-
virtual
Transforms this method invocation into a virtual (or interface) method invocation on the given type.- Specified by:
virtualin interfaceMethodInvocation.WithImplicitInvocationTargetType- Parameters:
invocationTarget- The type on which the method is to be invoked virtually on.- Returns:
- A stack manipulation representing this method invocation.
-
special
Transforms this method invocation into a special invocation on the given type.- Specified by:
specialin interfaceMethodInvocation.WithImplicitInvocationTargetType- Parameters:
invocationTarget- The type on which the method is to be invoked specially on.- Returns:
- A stack manipulation representing this method invocation.
-
dynamic
public StackManipulation dynamic(String methodName, TypeDescription returnType, List<? extends TypeDescription> methodType, List<? extends JavaConstant> arguments) Invokes the method as a bootstrap method to bind a call site with the given properties. Note that the Java virtual machine currently only knows how to resolve bootstrap methods that link static methods or a constructor.- Specified by:
dynamicin interfaceMethodInvocation.WithImplicitInvocationTargetType- Parameters:
methodName- The name of the method to be bound.returnType- The return type of the method to be bound.methodType- The parameter types of the method to be bound.arguments- The arguments to be passed to the bootstrap method.- Returns:
- A stack manipulation that represents the dynamic method invocation.
-
onHandle
Invokes the method via aMethodHandle.- Specified by:
onHandlein interfaceMethodInvocation.WithImplicitInvocationTargetType- Parameters:
type- The type of invocation.- Returns:
- A stack manipulation that represents a method call of the specified method via a method handle.
-