Package net.bytebuddy.asm
Class Advice.Dispatcher.Inlining.Resolved.AdviceMethodInliner
- java.lang.Object
-
- org.objectweb.asm.ClassVisitor
-
- net.bytebuddy.asm.Advice.Dispatcher.Inlining.Resolved.AdviceMethodInliner
-
- All Implemented Interfaces:
Advice.Dispatcher.Bound
- Direct Known Subclasses:
Advice.Dispatcher.Inlining.Resolved.ForMethodEnter.AdviceMethodInliner
,Advice.Dispatcher.Inlining.Resolved.ForMethodExit.AdviceMethodInliner
- Enclosing class:
- Advice.Dispatcher.Inlining.Resolved
protected abstract class Advice.Dispatcher.Inlining.Resolved.AdviceMethodInliner extends org.objectweb.asm.ClassVisitor implements Advice.Dispatcher.Bound
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
Advice.Dispatcher.Inlining.Resolved.AdviceMethodInliner.ExceptionTableCollector
A visitor that only writes try-catch-finally blocks to the supplied method visitor.protected class
Advice.Dispatcher.Inlining.Resolved.AdviceMethodInliner.ExceptionTableExtractor
A class visitor that extracts the exception tables of the advice method.protected class
Advice.Dispatcher.Inlining.Resolved.AdviceMethodInliner.ExceptionTableSubstitutor
A label substitutor allows to visit an advice method a second time after the exception handlers were already written.-
Nested classes/interfaces inherited from interface net.bytebuddy.asm.Advice.Dispatcher.Bound
Advice.Dispatcher.Bound.ForMethodEnter, Advice.Dispatcher.Bound.ForMethodExit, Advice.Dispatcher.Bound.SkipHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected Assigner
assigner
The assigner to use.protected org.objectweb.asm.ClassReader
classReader
A class reader for parsing the class file containing the represented advice method.protected Implementation.Context
implementationContext
The implementation context to use.protected MethodDescription
instrumentedMethod
The instrumented method.protected TypeDescription
instrumentedType
A description of the instrumented type.protected java.util.List<org.objectweb.asm.Label>
labels
The labels that were found during parsing the method's exception handler in the order of their discovery.protected Advice.MethodSizeHandler.ForInstrumentedMethod
methodSizeHandler
A handler for computing the method size requirements.protected org.objectweb.asm.MethodVisitor
methodVisitor
The method visitor for writing the instrumented method.protected Advice.StackMapFrameHandler.ForInstrumentedMethod
stackMapFrameHandler
A handler for translating and injecting stack map frames.protected Advice.Dispatcher.SuppressionHandler.Bound
suppressionHandler
A bound suppression handler that is used for suppressing exceptions of this advice method.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AdviceMethodInliner(TypeDescription instrumentedType, MethodDescription instrumentedMethod, org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Assigner assigner, Advice.MethodSizeHandler.ForInstrumentedMethod methodSizeHandler, Advice.StackMapFrameHandler.ForInstrumentedMethod stackMapFrameHandler, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler, org.objectweb.asm.ClassReader classReader)
Creates a new advice method inliner.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doApply()
Inlines the advice method.void
prepare()
Prepares the advice method's exception handlers.org.objectweb.asm.MethodVisitor
visitMethod(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String signature, java.lang.String[] exception)
-
-
-
Field Detail
-
instrumentedType
protected final TypeDescription instrumentedType
A description of the instrumented type.
-
instrumentedMethod
protected final MethodDescription instrumentedMethod
The instrumented method.
-
methodVisitor
protected final org.objectweb.asm.MethodVisitor methodVisitor
The method visitor for writing the instrumented method.
-
implementationContext
protected final Implementation.Context implementationContext
The implementation context to use.
-
assigner
protected final Assigner assigner
The assigner to use.
-
methodSizeHandler
protected final Advice.MethodSizeHandler.ForInstrumentedMethod methodSizeHandler
A handler for computing the method size requirements.
-
stackMapFrameHandler
protected final Advice.StackMapFrameHandler.ForInstrumentedMethod stackMapFrameHandler
A handler for translating and injecting stack map frames.
-
suppressionHandler
protected final Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler
A bound suppression handler that is used for suppressing exceptions of this advice method.
-
classReader
protected final org.objectweb.asm.ClassReader classReader
A class reader for parsing the class file containing the represented advice method.
-
labels
protected java.util.List<org.objectweb.asm.Label> labels
The labels that were found during parsing the method's exception handler in the order of their discovery.
-
-
Constructor Detail
-
AdviceMethodInliner
protected AdviceMethodInliner(TypeDescription instrumentedType, MethodDescription instrumentedMethod, org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, Assigner assigner, Advice.MethodSizeHandler.ForInstrumentedMethod methodSizeHandler, Advice.StackMapFrameHandler.ForInstrumentedMethod stackMapFrameHandler, Advice.Dispatcher.SuppressionHandler.Bound suppressionHandler, org.objectweb.asm.ClassReader classReader)
Creates a new advice method inliner.- Parameters:
instrumentedType
- A description of the instrumented type.instrumentedMethod
- The instrumented method.methodVisitor
- The method visitor for writing the instrumented method.implementationContext
- The implementation context to use.assigner
- The assigner to use.methodSizeHandler
- A handler for computing the method size requirements.stackMapFrameHandler
- A handler for translating and injecting stack map frames.suppressionHandler
- A bound suppression handler that is used for suppressing exceptions of this advice method.classReader
- A class reader for parsing the class file containing the represented advice method.
-
-
Method Detail
-
prepare
public void prepare()
Description copied from interface:Advice.Dispatcher.Bound
Prepares the advice method's exception handlers.- Specified by:
prepare
in interfaceAdvice.Dispatcher.Bound
-
doApply
protected void doApply()
Inlines the advice method.
-
visitMethod
public org.objectweb.asm.MethodVisitor visitMethod(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String signature, java.lang.String[] exception)
- Overrides:
visitMethod
in classorg.objectweb.asm.ClassVisitor
-
-