程序包 cn.taketoday.bytecode.commons
package cn.taketoday.bytecode.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 newLabel 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).
-
类说明A
MethodVisitorto insert before, after and around advices in methods and constructors.AMethodVisitorthat keeps track of stack map frame changes betweenAnalyzerAdapter.visitFrame(int, int, Object[], int, Object[])calls.AnAnnotationVisitorthat remaps types with aRemapper.AClassVisitorthat remaps types with aRemapper.A non standard code attribute used for testing purposes.AMethodVisitorthat approximates the size of the methods it visits.A non standard attribute used for testing purposes.AFieldVisitorthat remaps types with aRemapper.AMethodVisitorwith convenient methods to generate code.AMethodVisitorproviding a more detailed API to generate and transform instructions.AMethodVisitorthat removes JSR instructions and inlines the referenced subroutines.AMethodVisitorthat renumbers local variables in their order of appearance.AMethodVisitorthat remaps types with aRemapper.A named method descriptor.A ModuleHashes attribute.AModuleVisitorthat remaps types with aRemapper.A ModuleResolution attribute.A ModuleTarget attribute.ARecordComponentVisitorthat remaps types with aRemapper.A class responsible for remapping types and names.AClassVisitorthat adds a serial version unique identifier to a class if missing.ASignatureVisitorthat remaps types with aRemapper.AClassVisitorthat merges <clinit> methods into a single one.A code generator for switch statements.AMethodVisitoradapter to sort the exception handlers.