Package org.objectweb.asm.commons
Provides some useful class and method adapters. The preferred way of using
these adapters is by chaining them together and to custom adapters (instead of
inheriting from them). Indeed this approach provides more combination
possibilities than inheritance. For instance, suppose you want to implement an
adapter MyAdapter than needs sorted local variables and intermediate stack map
frame values taking into account the local variables sort. By using inheritance,
this would require MyAdapter to extend AnalyzerAdapter, itself extending
LocalVariablesSorter. But AnalyzerAdapter is not a subclass of
LocalVariablesSorter, so this is not possible. On the contrary, by using
delegation, you can make LocalVariablesSorter delegate to AnalyzerAdapter,
itself delegating to MyAdapter. In this case AnalyzerAdapter computes
intermediate frames based on the output of LocalVariablesSorter, and MyAdapter
can add new locals by calling the newLocal method on LocalVariablesSorter, and
can get the stack map frame state before each instruction by reading the locals
and stack fields in AnalyzerAdapter (this requires references from MyAdapter
back to LocalVariablesSorter and AnalyzerAdapter).
-
Interface Summary Interface Description TableSwitchGenerator A code generator for switch statements. -
Class Summary Class Description AdviceAdapter AMethodVisitor
to insert before, after and around advices in methods and constructors.AnalyzerAdapter AMethodVisitor
that keeps track of stack map frame changes betweenAnalyzerAdapter.visitFrame(int, int, Object[], int, Object[])
calls.AnnotationRemapper AnAnnotationVisitor
that remaps types with aRemapper
.ClassRemapper AClassVisitor
that remaps types with aRemapper
.CodeSizeEvaluator AMethodVisitor
that approximates the size of the methods it visits.FieldRemapper AFieldVisitor
that remaps types with aRemapper
.GeneratorAdapter AMethodVisitor
with convenient methods to generate code.InstructionAdapter AMethodVisitor
providing a more detailed API to generate and transform instructions.JSRInlinerAdapter AMethodVisitor
that removes JSR instructions and inlines the referenced subroutines.LocalVariablesSorter AMethodVisitor
that renumbers local variables in their order of appearance.Method A named method descriptor.MethodRemapper AMethodVisitor
that remaps types with aRemapper
.ModuleHashesAttribute A ModuleHashes attribute.ModuleRemapper AModuleVisitor
that remaps types with aRemapper
.ModuleResolutionAttribute A ModuleResolution attribute.ModuleTargetAttribute A ModuleTarget attribute.Remapper A class responsible for remapping types and names.SerialVersionUIDAdder AClassVisitor
that adds a serial version unique identifier to a class if missing.SignatureRemapper ASignatureVisitor
that remaps types with aRemapper
.SimpleRemapper ARemapper
using aMap
to define its mapping.StaticInitMerger AClassVisitor
that merges <clinit> methods into a single one.TryCatchBlockSorter AMethodVisitor
adapter to sort the exception handlers.