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 java.lang.Object implements MemberSubstitution.Replacement
A replacement that substitutes a invokedynamic instruction.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
MemberSubstitution.Replacement.ForDynamicInvocation.Factory
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
Fields Modifier and Type Field Description private ElementMatcher.Junction<? super java.util.List<JavaConstant>>
argumentsMatcher
A matcher for an invokedynamic instruction's constant arguments.private ElementMatcher<? super JavaConstant.MethodHandle>
handleMatcher
A matcher for an invokedynamic bootstrap method.private ElementMatcher.Junction<? super java.lang.String>
nameMatcher
A matcher for an invokedynamic instruction's name.private MemberSubstitution.Substitution<? super MemberSubstitution.Target.ForDynamicInvocation>
substitution
The substitution to apply.private ElementMatcher.Junction<? super JavaConstant.MethodType>
typeMatcher
A matcher for an invokedynamic instruction's result type.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForDynamicInvocation(ElementMatcher<? super JavaConstant.MethodHandle> handleMatcher, ElementMatcher.Junction<? super java.lang.String> nameMatcher, ElementMatcher.Junction<? super JavaConstant.MethodType> typeMatcher, ElementMatcher.Junction<? super java.util.List<JavaConstant>> argumentsMatcher, MemberSubstitution.Substitution<? super MemberSubstitution.Target.ForDynamicInvocation> substitution)
Creates a replacement for an invokedynamic instruction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MemberSubstitution.Replacement.Binding
bind(TypeDescription instrumentedType, MethodDescription instrumentedMethod, TypeDescription typeDescription, FieldDescription fieldDescription, boolean writeAccess)
Binds this replacement for a field that was discovered.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.MemberSubstitution.Replacement.Binding
bind(TypeDescription instrumentedType, MethodDescription instrumentedMethod, JavaConstant.MethodHandle methodHandle, JavaConstant.MethodType methodType, java.lang.String name, java.util.List<JavaConstant> constants)
Binds this replacement for a dynamic method invocation that was discovered.
-
-
-
Field Detail
-
handleMatcher
private final ElementMatcher<? super JavaConstant.MethodHandle> handleMatcher
A matcher for an invokedynamic bootstrap method.
-
nameMatcher
private final ElementMatcher.Junction<? super java.lang.String> nameMatcher
A matcher for an invokedynamic instruction's name.
-
typeMatcher
private final ElementMatcher.Junction<? super JavaConstant.MethodType> typeMatcher
A matcher for an invokedynamic instruction's result type.
-
argumentsMatcher
private final ElementMatcher.Junction<? super java.util.List<JavaConstant>> argumentsMatcher
A matcher for an invokedynamic instruction's constant arguments.
-
substitution
private final MemberSubstitution.Substitution<? super MemberSubstitution.Target.ForDynamicInvocation> substitution
The substitution to apply.
-
-
Constructor Detail
-
ForDynamicInvocation
protected ForDynamicInvocation(ElementMatcher<? super JavaConstant.MethodHandle> handleMatcher, ElementMatcher.Junction<? super java.lang.String> nameMatcher, ElementMatcher.Junction<? super JavaConstant.MethodType> typeMatcher, ElementMatcher.Junction<? super java.util.List<JavaConstant>> argumentsMatcher, MemberSubstitution.Substitution<? super MemberSubstitution.Target.ForDynamicInvocation> 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 Detail
-
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, java.lang.String name, java.util.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.
-
-