Package net.bytebuddy.asm
The ASM package contains classes that are meant for direct interaction with the ASM API.
-
Interface Summary Interface Description Advice.ArgumentHandler An argument handler is responsible for resolving offsets of the local variable array in the context of the applied instrumentation.Advice.ArgumentHandler.ForAdvice An argument handler that is used for resolving an advice method.Advice.ArgumentHandler.ForInstrumentedMethod An argument handler that is used for resolving the instrumented method.Advice.Dispatcher A dispatcher for implementing advice.Advice.Dispatcher.Bound A bound resolution of an advice method.Advice.Dispatcher.RelocationHandler A relocation handler is responsible for chaning the usual control flow of an instrumented method.Advice.Dispatcher.RelocationHandler.Bound A boundAdvice.Dispatcher.RelocationHandler
.Advice.Dispatcher.RelocationHandler.Relocation A relocator is responsible for triggering a relocation if a relocation handler triggers a relocating condition.Advice.Dispatcher.Resolved Represents a resolved dispatcher.Advice.Dispatcher.Resolved.ForMethodEnter Represents a resolved dispatcher for entering a method.Advice.Dispatcher.Resolved.ForMethodExit Represents a resolved dispatcher for exiting a method.Advice.Dispatcher.SuppressionHandler A suppression handler for optionally suppressing exceptions.Advice.Dispatcher.SuppressionHandler.Bound A bound version of a suppression handler that must not be reused.Advice.Dispatcher.SuppressionHandler.ReturnValueProducer A producer for a default return value if this is applicable.Advice.Dispatcher.Unresolved A dispatcher that is not yet resolved.Advice.MethodSizeHandler A handler for computing the instrumented method's size.Advice.MethodSizeHandler.ForAdvice A method size handler for an advice method.Advice.MethodSizeHandler.ForInstrumentedMethod A method size handler for the instrumented method.Advice.OffsetMapping Represents an offset mapping for an advice method to an alternative offset.Advice.OffsetMapping.Factory<T extends java.lang.annotation.Annotation> Represents a factory for creating aAdvice.OffsetMapping
for a given parameter for a given annotation.Advice.OffsetMapping.ForOrigin.Renderer A renderer for an origin pattern element.Advice.OffsetMapping.Target A target offset of an offset mapping.Advice.StackMapFrameHandler A handler for computing and translating stack map frames.Advice.StackMapFrameHandler.ForAdvice A stack map frame handler for an advice method.Advice.StackMapFrameHandler.ForInstrumentedMethod A stack map frame handler for an instrumented method.AsmVisitorWrapper A class visitor wrapper is used in order to register an intermediate ASMClassVisitor
which is applied to the main type created by aDynamicType.Builder
but not to anyAuxiliaryType
s, if any.AsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper A field visitor wrapper that allows for wrapping aFieldVisitor
defining a declared field.AsmVisitorWrapper.ForDeclaredMethods.MethodVisitorWrapper A method visitor wrapper that allows for wrapping aMethodVisitor
defining a declared method.MemberSubstitution.Substitution Resolves an actual substitution.MemberSubstitution.Substitution.Resolver A resolver supplies an implementation for a substitution.MemberSubstitution.TypePoolResolver A type pool resolver is responsible for resolving aTypePool
for locating substituted members. -
Class Summary Class Description Advice Advice wrappers copy the code of blueprint methods to be executed before and/or after a matched method.Advice.AdviceVisitor A method visitor that weaves the advice methods' byte codes.Advice.AdviceVisitor.WithExitAdvice An advice visitor that applies exit advice.Advice.AdviceVisitor.WithExitAdvice.WithExceptionHandling An advice visitor that captures exceptions by weaving try-catch blocks around user code.Advice.AdviceVisitor.WithExitAdvice.WithoutExceptionHandling An advice visitor that does not capture exceptions.Advice.AdviceVisitor.WithoutExitAdvice An advice visitor that does not apply exit advice.Advice.Appender A byte code appender for implementingAdvice
.Advice.Appender.EmulatingMethodVisitor A method visitor that allows for the emulation of a full method visitor invocation circle without delegating initial and ending visitations to the underlying visitor.Advice.ArgumentHandler.ForAdvice.ForMethodEnter An argument handler for an enter advice method.Advice.ArgumentHandler.ForAdvice.ForMethodExit An argument handler for an exit advice method.Advice.ArgumentHandler.ForInstrumentedMethod.Copying An argument handler for an instrumented method that copies all arguments before executing the instrumented method.Advice.ArgumentHandler.ForInstrumentedMethod.Simple A simple argument handler for an instrumented method.Advice.Dispatcher.Delegating A dispatcher for an advice method that is being invoked from the instrumented method.Advice.Dispatcher.Delegating.Resolved A resolved version of a dispatcher.Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter A bound advice method that copies the code by first extracting the exception table and later appending the code of the method without copying any meta data.Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter.ForMethodEnter An advice method writer for a method enter.Advice.Dispatcher.Delegating.Resolved.AdviceMethodWriter.ForMethodExit An advice method writer for a method exit.Advice.Dispatcher.Delegating.Resolved.ForMethodEnter A resolved dispatcher for implementing method enter advice.Advice.Dispatcher.Delegating.Resolved.ForMethodEnter.WithDiscardedEnterType Implementation of an advice that does not expose an enter type.Advice.Dispatcher.Delegating.Resolved.ForMethodEnter.WithRetainedEnterType Implementation of an advice that does expose an enter type.Advice.Dispatcher.Delegating.Resolved.ForMethodExit A resolved dispatcher for implementing method exit advice.Advice.Dispatcher.Delegating.Resolved.ForMethodExit.WithExceptionHandler Implementation of exit advice that handles exceptions.Advice.Dispatcher.Delegating.Resolved.ForMethodExit.WithoutExceptionHandler Implementation of exit advice that ignores exceptions.Advice.Dispatcher.Inlining A dispatcher for an advice method that is being inlined into the instrumented method.Advice.Dispatcher.Inlining.CodeTranslationVisitor A visitor for translating an advice method's byte code for inlining into the instrumented method.Advice.Dispatcher.Inlining.CodeTranslationVisitor.ForMethodEnter A code translation visitor that retains the return value of the represented advice method.Advice.Dispatcher.Inlining.CodeTranslationVisitor.ForMethodExit A code translation visitor that discards the return value of the represented advice method.Advice.Dispatcher.Inlining.Resolved A resolved version of a dispatcher.Advice.Dispatcher.Inlining.Resolved.ForMethodEnter A resolved dispatcher for implementing method enter advice.Advice.Dispatcher.Inlining.Resolved.ForMethodEnter.WithDiscardedEnterType Implementation of an advice that does not expose an enter type.Advice.Dispatcher.Inlining.Resolved.ForMethodEnter.WithRetainedEnterType Implementation of an advice that does expose an enter type.Advice.Dispatcher.Inlining.Resolved.ForMethodExit A resolved dispatcher for implementing method exit advice.Advice.Dispatcher.Inlining.Resolved.ForMethodExit.WithExceptionHandler Implementation of exit advice that handles exceptions.Advice.Dispatcher.Inlining.Resolved.ForMethodExit.WithoutExceptionHandler Implementation of exit advice that ignores exceptions.Advice.Dispatcher.RelocationHandler.ForType A relocation handler that is triggered if the checked value is an instance of a given type.Advice.Dispatcher.RelocationHandler.ForType.Bound A bound relocation handler forAdvice.Dispatcher.RelocationHandler.ForType
.Advice.Dispatcher.Resolved.AbstractBase An abstract base implementation of aAdvice.Dispatcher.Resolved
dispatcher.Advice.Dispatcher.SuppressionHandler.Suppressing A suppression handler that suppresses a given throwable type.Advice.Dispatcher.SuppressionHandler.Suppressing.Bound An active, bound suppression handler.Advice.MethodSizeHandler.Default A default implementation for a method size handler.Advice.MethodSizeHandler.Default.WithCopiedArguments A method size handler that expects that the original arguments were copied.Advice.MethodSizeHandler.Default.WithRetainedArguments A method size handler that expects that the original arguments are retained.Advice.OffsetMapping.Factory.Illegal<T extends java.lang.annotation.Annotation> A factory for an annotation whose use is not permitted.Advice.OffsetMapping.Factory.Simple<T extends java.lang.annotation.Annotation> A simple factory that binds a constant offset mapping.Advice.OffsetMapping.ForAllArguments An offset mapping that maps an array containing all arguments of the instrumented method.Advice.OffsetMapping.ForArgument An offset mapping for a given parameter of the instrumented method.Advice.OffsetMapping.ForArgument.Resolved An offset mapping for a specific parameter of the instrumented method.Advice.OffsetMapping.ForArgument.Resolved.Factory<T extends java.lang.annotation.Annotation> A factory for a parameter argument of the instrumented method.Advice.OffsetMapping.ForArgument.Unresolved An offset mapping for a parameter of the instrumented method with a specific index.Advice.OffsetMapping.ForEnterValue An offset mapping that provides access to the value that is returned by the enter advice.Advice.OffsetMapping.ForEnterValue.Factory A factory for creating aAdvice.OffsetMapping.ForEnterValue
offset mapping.Advice.OffsetMapping.ForField An offset mapping for a field.Advice.OffsetMapping.ForField.Resolved A binding for an offset mapping that represents a specific field.Advice.OffsetMapping.ForField.Resolved.Factory<T extends java.lang.annotation.Annotation> A factory that binds a field.Advice.OffsetMapping.ForField.Unresolved An offset mapping for a field that is resolved from the instrumented type by its name.Advice.OffsetMapping.ForField.Unresolved.WithExplicitType An offset mapping for a field with an explicit declaring type.Advice.OffsetMapping.ForField.Unresolved.WithImplicitType An offset mapping for a field with an implicit declaring type.Advice.OffsetMapping.ForOrigin An offset mapping for theAdvice.Origin
annotation.Advice.OffsetMapping.ForOrigin.Renderer.ForConstantValue A renderer for a constant value.Advice.OffsetMapping.ForReturnValue An offset mapping that provides access to the value that is returned by the instrumented method.Advice.OffsetMapping.ForSerializedValue An offset mapping that loads a serialized value.Advice.OffsetMapping.ForSerializedValue.Factory<T extends java.lang.annotation.Annotation> A factory for loading a deserialized value.Advice.OffsetMapping.ForStackManipulation An offset mapping for binding a stack manipulation.Advice.OffsetMapping.ForStackManipulation.Factory<T extends java.lang.annotation.Annotation> A factory that binds a stack manipulation.Advice.OffsetMapping.ForStackManipulation.OfAnnotationProperty<T extends java.lang.annotation.Annotation> A factory for binding an annotation's property.Advice.OffsetMapping.ForStackManipulation.OfDefaultValue<T extends java.lang.annotation.Annotation> A factory for binding the annotated parameter's default value.Advice.OffsetMapping.ForThisReference An offset mapping that provides access to thethis
reference of the instrumented method.Advice.OffsetMapping.ForThrowable An offset mapping for accessing aThrowable
of the instrumented method.Advice.OffsetMapping.ForUnusedValue An offset mapping for a parameter where assignments are fully ignored and that always return the parameter type's default value.Advice.OffsetMapping.Target.AbstractReadOnlyAdapter An adapter class for a target that only can be read.Advice.OffsetMapping.Target.ForArray A target mapping for an array of all local variables.Advice.OffsetMapping.Target.ForArray.ReadOnly A target mapping for a read-only target mapping for an array of local variables.Advice.OffsetMapping.Target.ForArray.ReadWrite A target mapping for a writable target mapping for an array of local variables.Advice.OffsetMapping.Target.ForDefaultValue A target for an offset mapping that represents a non-operational value.Advice.OffsetMapping.Target.ForDefaultValue.ReadOnly A read-only target for a default value.Advice.OffsetMapping.Target.ForDefaultValue.ReadWrite A read-write target for a default value.Advice.OffsetMapping.Target.ForField A target for an offset mapping that loads a field value.Advice.OffsetMapping.Target.ForField.ReadOnly A read-only mapping for a field value.Advice.OffsetMapping.Target.ForField.ReadWrite A mapping for a writable field.Advice.OffsetMapping.Target.ForStackManipulation A target for an offset mapping that represents a read-only stack manipulation.Advice.OffsetMapping.Target.ForVariable A target for an offset mapping that represents a local variable.Advice.OffsetMapping.Target.ForVariable.ReadOnly A target for a read-only mapping of a local variable.Advice.OffsetMapping.Target.ForVariable.ReadWrite A target for a writable mapping of a local variable.Advice.OnDefaultValue A marker type to be used as an argument forAdvice.OnMethodEnter.skipOn()
.Advice.OnNonDefaultValue A marker type to be used as an argument forAdvice.OnMethodEnter.skipOn()
.Advice.StackMapFrameHandler.Default A default implementation of a stack map frame handler for an instrumented method.Advice.StackMapFrameHandler.Default.Trivial A trivial stack map frame handler that applies a trivial translation for the instrumented method's stack map frames.Advice.StackMapFrameHandler.Default.WithPreservedArguments A stack map frame handler that requires the original arguments of the instrumented method to be preserved in their original form.Advice.StackMapFrameHandler.Default.WithPreservedArguments.RequiringConsistentShape A stack map frame handler that expects that the original argument frames remain preserved throughout the original invocation.Advice.StackMapFrameHandler.Default.WithPreservedArguments.UsingArgumentCopy A stack map frame handler that expects that an argument copy of the original method arguments was made.Advice.WithCustomMapping A builder step for creating anAdvice
that uses custom mappings of annotations to constant pool values.AsmVisitorWrapper.AbstractBase An abstract base implementation of an ASM visitor wrapper that does not set any flags.AsmVisitorWrapper.Compound An ordered, immutable chain ofAsmVisitorWrapper
s.AsmVisitorWrapper.ForDeclaredFields An ASM visitor wrapper that allows to wrap declared fields of the instrumented type with aAsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper
.AsmVisitorWrapper.ForDeclaredFields.Entry An entry describing a field visitor wrapper paired with a matcher for fields to be wrapped.AsmVisitorWrapper.ForDeclaredMethods An ASM visitor wrapper that allows to wrap declared methods of the instrumented type with aAsmVisitorWrapper.ForDeclaredMethods.MethodVisitorWrapper
.AsmVisitorWrapper.ForDeclaredMethods.Entry An entry describing a method visitor wrapper paired with a matcher for fields to be wrapped.MemberRemoval A visitor wrapper that removes fields or methods that match a givenElementMatcher
.MemberRemoval.MemberRemovingClassVisitor A class visitor that removes members based on element matchers.MemberSubstitution Substitutes field access or method invocations within a method's body.MemberSubstitution.SubstitutingMethodVisitor A method visitor that applies a substitution for matched methods.MemberSubstitution.Substitution.Compound A compound substitution.MemberSubstitution.Substitution.ForElementMatchers A substitution that uses element matchers for determining if a byte code element should be substituted.MemberSubstitution.Substitution.Resolver.FieldAccessing A resolver that replaces an interaction with a byte code element with a field access.MemberSubstitution.Substitution.Resolver.MethodInvoking A resolver that invokes a method.MemberSubstitution.TypePoolResolver.ForClassFileLocator A type pool resolver that resolves the implicit pool but additionally checks another class file locator.MemberSubstitution.TypePoolResolver.ForExplicitPool A type pool resolver that returns a specific type pool.MemberSubstitution.WithoutSpecification A member substitution that lacks a specification for how to substitute the matched members references within a method body.MemberSubstitution.WithoutSpecification.ForMatchedByteCodeElement Describes a member substitution that requires a specification for how to replace a byte code element.MemberSubstitution.WithoutSpecification.ForMatchedField Describes a member substitution that requires a specification for how to replace a field.MemberSubstitution.WithoutSpecification.ForMatchedMethod Describes a member substitution that requires a specification for how to replace a method or constructor.ModifierAdjustment A visitor wrapper that adjusts the modifiers of the instrumented type or its members.ModifierAdjustment.Adjustment<T> A description of a conditional adjustment.ModifierAdjustment.ModifierAdjustingClassVisitor A class visitor that enforces a collection of modifier adjustments.TypeConstantAdjustment.TypeConstantDissolvingClassVisitor A class visitor that checks a class file version for its support of storing class constants in the constant pool and remaps such constants on discovery if that is not the case.TypeConstantAdjustment.TypeConstantDissolvingClassVisitor.TypeConstantDissolvingMethodVisitor A method visitor that remaps class constants to invocations ofClass.forName(String)
. -
Enum Summary Enum Description Advice.ArgumentHandler.Factory A factory for creating an argument handler.Advice.Dispatcher.Inactive An implementation for inactive devise that does not write any byte code.Advice.Dispatcher.RelocationHandler.Disabled A disabled relocation handler that does never trigger a relocation.Advice.Dispatcher.RelocationHandler.ForValue A relocation handler that triggers a relocation for a default or non-default value.Advice.Dispatcher.RelocationHandler.Relocation.Illegal A relocator that does not allow for relocation.Advice.Dispatcher.SuppressionHandler.NoOp A non-operational suppression handler that does not suppress any method.Advice.MethodSizeHandler.NoOp A non-operational method size handler.Advice.OffsetMapping.Factory.AdviceType Describes the type of advice being applied.Advice.OffsetMapping.ForAllArguments.Factory A factory for an offset mapping that maps all arguments values of the instrumented method.Advice.OffsetMapping.ForArgument.Unresolved.Factory A factory for a mapping of a parameter of the instrumented method.Advice.OffsetMapping.ForField.Unresolved.Factory A factory for aAdvice.OffsetMapping.ForField.Unresolved
offset mapping.Advice.OffsetMapping.ForInstrumentedMethod Maps a constant representing the instrumented method.Advice.OffsetMapping.ForInstrumentedType Maps the declaring type of the instrumented method.Advice.OffsetMapping.ForOrigin.Factory A factory for a method origin.Advice.OffsetMapping.ForOrigin.Renderer.ForDescriptor A renderer for a method descriptor.Advice.OffsetMapping.ForOrigin.Renderer.ForJavaSignature A renderer for a method's Java signature in binary form.Advice.OffsetMapping.ForOrigin.Renderer.ForMethodName A renderer for a method's internal name.Advice.OffsetMapping.ForOrigin.Renderer.ForReturnTypeName A renderer for a method's return type in binary form.Advice.OffsetMapping.ForOrigin.Renderer.ForStringRepresentation A renderer for a method'sObject.toString()
representation.Advice.OffsetMapping.ForOrigin.Renderer.ForTypeName A renderer for a method declaring type's binary name.Advice.OffsetMapping.ForReturnValue.Factory A factory for creating aAdvice.OffsetMapping.ForReturnValue
offset mapping.Advice.OffsetMapping.ForStubValue An offset mapping for a parameter where assignments are fully ignored and that is assigned a boxed version of the instrumented method's return value ornull
if the return type is not primitive orvoid
.Advice.OffsetMapping.ForThisReference.Factory A factory for creating aAdvice.OffsetMapping.ForThisReference
offset mapping.Advice.OffsetMapping.ForThrowable.Factory A factory for accessing an exception that was thrown by the instrumented method.Advice.OffsetMapping.ForUnusedValue.Factory A factory for an offset mapping for an unused value.Advice.OffsetMapping.Sort Describes the sort of the executed advice.Advice.StackMapFrameHandler.Default.TranslationMode A translation mode that determines how the fixed frames of the instrumented method are written.Advice.StackMapFrameHandler.NoOp A non-operational stack map frame handler.AsmVisitorWrapper.NoOp A class visitor wrapper that does not apply any changes.MemberSubstitution.Substitution.InvocationType Determines a method's invocation type.MemberSubstitution.Substitution.NoOp A substitution that does not substitute any byte code elements.MemberSubstitution.Substitution.Resolver.Stubbing A resolver that stubs any interaction with a byte code element.MemberSubstitution.Substitution.Resolver.Unresolved An unresolved resolver that does not apply a substitution.MemberSubstitution.TypePoolResolver.OfImplicitPool Returns the implicit type pool.TypeConstantAdjustment This class visitor wrapper ensures that class files of a version previous to Java 5 do not store class entries in the generated class's constant pool. -
Annotation Types Summary Annotation Type Description Advice.AllArguments Assigns an array containing all arguments of the instrumented method to the annotated parameter.Advice.Argument Indicates that the annotated parameter should be mapped to the parameter with indexAdvice.Argument.value()
of the instrumented method.Advice.Enter Indicates that the annotated parameter should be mapped to the value that is returned by the advice method that is annotated byAdvice.OnMethodEnter
.Advice.FieldValue Indicates that the annotated parameter should be mapped to a field in the scope of the instrumented method.Advice.OnMethodEnter Indicates that this method should be inlined before the matched method is invoked.Advice.OnMethodExit Indicates that this method should be executed before exiting the instrumented method.Advice.Origin Indicates that the annotated parameter should be mapped to a string representation of the instrumented method, a constant representing theClass
declaring the adviced method or aMethod
,Constructor
orjava.lang.reflect.Executable
representing this method.Advice.Return Indicates that the annotated parameter should be mapped to the return value of the instrumented method.Advice.StubValue Indicates that the annotated parameter should always return a default a boxed version of the instrumented methods return value (i.e.Advice.This Indicates that the annotated parameter should be mapped to thethis
reference of the instrumented method.Advice.Thrown Indicates that the annotated parameter should be mapped to theThrowable
thrown by the instrumented method or tonull
if the method returned regularly.Advice.Unused Indicates that the annotated parameter should always return a default value (i.e.