Package net.bytebuddy.asm
Class MemberSubstitution.Replacement.ForDynamicInvocation
java.lang.Object
net.bytebuddy.asm.MemberSubstitution.Replacement.ForDynamicInvocation
- All Implemented Interfaces:
MemberSubstitution.Replacement
- Enclosing interface:
MemberSubstitution.Replacement
@Enhance
public static class MemberSubstitution.Replacement.ForDynamicInvocation
extends Object
implements MemberSubstitution.Replacement
A replacement that substitutes a invokedynamic instruction.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
A factory for a replacement for an invokedynamic instruction.Nested classes/interfaces inherited from interface net.bytebuddy.asm.MemberSubstitution.Replacement
MemberSubstitution.Replacement.Binding, MemberSubstitution.Replacement.ForDynamicInvocation, MemberSubstitution.Replacement.ForElementMatchers, MemberSubstitution.Replacement.ForFirstBinding, MemberSubstitution.Replacement.InvocationType, MemberSubstitution.Replacement.NoOp
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ElementMatcher.Junction
<? super List<JavaConstant>> A matcher for an invokedynamic instruction's constant arguments.private final ElementMatcher
<? super JavaConstant.MethodHandle> A matcher for an invokedynamic bootstrap method.private final ElementMatcher.Junction
<? super String> A matcher for an invokedynamic instruction's name.private final MemberSubstitution.Substitution
The substitution to apply.private final ElementMatcher.Junction
<? super JavaConstant.MethodType> A matcher for an invokedynamic instruction's result type. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ForDynamicInvocation
(ElementMatcher<? super JavaConstant.MethodHandle> handleMatcher, ElementMatcher.Junction<? super String> nameMatcher, ElementMatcher.Junction<? super JavaConstant.MethodType> typeMatcher, ElementMatcher.Junction<? super List<JavaConstant>> argumentsMatcher, MemberSubstitution.Substitution substitution) Creates a replacement for an invokedynamic instruction. -
Method Summary
Modifier and TypeMethodDescriptionbind
(TypeDescription instrumentedType, MethodDescription instrumentedMethod, TypeDescription typeDescription, FieldDescription fieldDescription, boolean writeAccess) Binds this replacement for a field that was discovered.bind
(TypeDescription instrumentedType, MethodDescription instrumentedMethod, TypeDescription typeDescription, MethodDescription methodDescription, MemberSubstitution.Replacement.InvocationType invocationType) Binds this replacement for a field that was discovered.bind
(TypeDescription instrumentedType, MethodDescription instrumentedMethod, JavaConstant.MethodHandle methodHandle, JavaConstant.MethodType methodType, String name, List<JavaConstant> constants) Binds this replacement for a dynamic method invocation that was discovered.
-
Field Details
-
handleMatcher
A matcher for an invokedynamic bootstrap method. -
nameMatcher
A matcher for an invokedynamic instruction's name. -
typeMatcher
A matcher for an invokedynamic instruction's result type. -
argumentsMatcher
A matcher for an invokedynamic instruction's constant arguments. -
substitution
The substitution to apply.
-
-
Constructor Details
-
ForDynamicInvocation
protected ForDynamicInvocation(ElementMatcher<? super JavaConstant.MethodHandle> handleMatcher, ElementMatcher.Junction<? super String> nameMatcher, ElementMatcher.Junction<? super JavaConstant.MethodType> typeMatcher, ElementMatcher.Junction<? super List<JavaConstant>> argumentsMatcher, MemberSubstitution.Substitution substitution) Creates a replacement for an invokedynamic instruction.- Parameters:
handleMatcher
- A matcher for an invokedynamic bootstrap method.nameMatcher
- A matcher for an invokedynamic instruction's name.typeMatcher
- A matcher for an invokedynamic instruction's result type.argumentsMatcher
- A matcher for an invokedynamic instruction's constant arguments.substitution
- The substitution to apply.
-
-
Method Details
-
bind
public MemberSubstitution.Replacement.Binding bind(TypeDescription instrumentedType, MethodDescription instrumentedMethod, TypeDescription typeDescription, FieldDescription fieldDescription, boolean writeAccess) Binds this replacement for a field that was discovered.- Specified by:
bind
in interfaceMemberSubstitution.Replacement
- Parameters:
instrumentedType
- The instrumented type.instrumentedMethod
- The instrumented method.typeDescription
- The type on which the field was read.fieldDescription
- The field that was discovered.writeAccess
-true
if this field was written to.- Returns:
- A binding for the discovered field access.
-
bind
public MemberSubstitution.Replacement.Binding bind(TypeDescription instrumentedType, MethodDescription instrumentedMethod, TypeDescription typeDescription, MethodDescription methodDescription, MemberSubstitution.Replacement.InvocationType invocationType) Binds this replacement for a field that was discovered.- Specified by:
bind
in interfaceMemberSubstitution.Replacement
- Parameters:
instrumentedType
- The instrumented type.FieldDescriptioninstrumentedMethod
- The instrumented method.typeDescription
- The type on which the method was invoked.methodDescription
- The method that was discovered.invocationType
- The invocation type for this method.- Returns:
- A binding for the discovered method invocation.
-
bind
public MemberSubstitution.Replacement.Binding bind(TypeDescription instrumentedType, MethodDescription instrumentedMethod, JavaConstant.MethodHandle methodHandle, JavaConstant.MethodType methodType, String name, List<JavaConstant> constants) Binds this replacement for a dynamic method invocation that was discovered.- Specified by:
bind
in interfaceMemberSubstitution.Replacement
- Parameters:
instrumentedType
- The instrumented type.FieldDescriptioninstrumentedMethod
- The instrumented method.methodHandle
- The method handle of the bootstrap method.methodType
- The type of the method that is bound.name
- The name of the method that is bound.constants
- The constant arguments to the bootstrap method.- Returns:
- A binding for the discovered method invocation.
-