### Simple Java 'Hello World' Class Example Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/GeneratorAdapter A basic Java class demonstrating a `main` method that prints 'Hello world!' to the console. This class serves as the target for bytecode generation examples using ASM. ```Java public class Example { public static void main(String[] args) { System.out.println("Hello world!"); } } ``` -------------------------------- ### Example Usage of SerialVersionUIDAdder in Java Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/SerialVersionUIDAdder This Java code snippet demonstrates how to integrate the `SerialVersionUIDAdder` into a class transformation pipeline using ASM. It shows the typical setup with `ClassWriter`, `SerialVersionUIDAdder`, and a custom `ClassVisitor` (`MyClassAdapter`) to process a class. ```Java ClassWriter classWriter = new ClassWriter(...); ClassVisitor svuidAdder = new SerialVersionUIDAdder(classWriter); ClassVisitor classVisitor = new MyClassAdapter(svuidAdder); new ClassReader(orginalClass).accept(classVisitor, 0); ``` -------------------------------- ### Example Bytecode Trace for Hello Class Source: https://asm.ow2.io/javadoc/org/objectweb/asm/util/TraceClassVisitor Illustrates the output generated by `TraceClassVisitor` when used with a `Textifier` for a simple 'Hello' class, showing its structure, methods, and bytecode instructions as a trace. ```Java // class version 49.0 (49) // access flags 0x21 public class Hello { // compiled from: Hello.java // access flags 0x1 public ()V ALOAD 0 INVOKESPECIAL java/lang/Object ()V RETURN MAXSTACK = 1 MAXLOCALS = 1 // access flags 0x9 public static main ([Ljava/lang/String;)V GETSTATIC java/lang/System out Ljava/io/PrintStream; LDC "hello" INVOKEVIRTUAL java/io/PrintStream println (Ljava/lang/String;)V RETURN MAXSTACK = 2 MAXLOCALS = 1 } ``` -------------------------------- ### API: MethodVisitor.visitLdcInsn Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Documents the `visitLdcInsn` method, used for LDC instructions. It explains the expected constant types and advises implementations to check for unexpected types, providing a Java example for type checking. ```APIDOC public void visitLdcInsn(Object value) Description: Visits a LDC instruction. Note that new constant types may be added in future versions of the Java Virtual Machine. To easily detect new constant types, implementations of this method should check for unexpected constant types. Overrides: MethodVisitor.visitLdcInsn Parameters: value: The constant to be loaded on the stack. This parameter must be a non null Integer, a Float, a Long, a Double, a String, a Type of OBJECT or ARRAY sort for .class constants, a Type of METHOD sort for MethodType, a Handle for MethodHandle constants, or a ConstantDynamic for a constant dynamic. ``` -------------------------------- ### ASM MethodVisitor: visitCode Method Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Starts the visit of the method's code. This method is invoked for non-abstract methods and overrides the `visitCode` method from `MethodVisitor`. ```APIDOC public void visitCode() Description copied from class: MethodVisitor Starts the visit of the method's code, if any (i.e. non abstract method). Overrides: visitCode in class MethodVisitor ``` -------------------------------- ### Get List Iterator from Index (iterator) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/tree/InsnList Returns a ListIterator over the instructions in this list, starting at a specified index. ```APIDOC public ListIterator iterator(int index) Description: Returns an iterator over the instructions in this list. Parameters: index: index of instruction for the iterator to start at. Returns: an iterator over the instructions in this list. ``` -------------------------------- ### SerialVersionUIDAdder Class API Reference Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/SerialVersionUIDAdder Detailed API documentation for the `SerialVersionUIDAdder` class, including its constructors and the `visit` method, part of the `org.objectweb.asm.commons` package. This snippet outlines method signatures, parameters, return types, and descriptions. ```APIDOC Class: SerialVersionUIDAdder Package: org.objectweb.asm.commons Inherited Methods from java.lang.Object: clone() equals(java.lang.Object) finalize() getClass() hashCode() notify() notifyAll() toString() wait() wait(long) wait(long, int) Constructor Details: public SerialVersionUIDAdder(ClassVisitor classVisitor) Description: Constructs a new SerialVersionUIDAdder. Subclasses must not use this constructor. Instead, they must use the SerialVersionUIDAdder(int, ClassVisitor) version. Parameters: classVisitor: a ClassVisitor to which this visitor will delegate calls. Throws: IllegalStateException: If a subclass calls this constructor. protected SerialVersionUIDAdder(int api, ClassVisitor classVisitor) Description: Constructs a new SerialVersionUIDAdder. Parameters: api: the ASM API version implemented by this visitor. Must be one of the ASM*x values in Opcodes. classVisitor: a ClassVisitor to which this visitor will delegate calls. Method Details: public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) Description: Visits the header of the class. (Description copied from class: ClassVisitor) Overrides: visit in class ClassVisitor Parameters: version: the class version. The minor version is stored in the 16 most significant bits, and the major version in the 16 least significant bits. access: the class's access flags (see Opcodes). This parameter also indicates if the class is deprecated Opcodes.ACC_DEPRECATED or a record Opcodes.ACC_RECORD. name: the internal name of the class (see Type.getInternalName()). signature: the signature of this class. May be null if the class is not a generic one, and does not extend or implement generic classes or interfaces. superName: the internal of name of the super class (see Type.getInternalName()). interfaces: (No description provided in source) ``` -------------------------------- ### Get Array Element Type Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns the type of the elements of this array type. For example, for `int[][]`, it would return the `Type` representing `int[]`. This method helps in navigating array type hierarchies during bytecode processing. ```APIDOC Type getElementType() ``` -------------------------------- ### API: MethodVisitor.visitTypeInsn (Partial) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Partial documentation for the `visitTypeInsn` method, which handles instructions with a type operand. ```APIDOC public void visitTypeInsn(int opcode, ``` -------------------------------- ### AdviceAdapter Class API Reference Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Detailed API documentation for the `AdviceAdapter` class, a utility class in the ASM library designed to simplify bytecode manipulation by providing hooks before and after method execution. It includes the constructor signature and descriptions of key methods like `onMethodEnter`, `onMethodExit`, `visitCode`, and `visitFieldInsn`. ```APIDOC AdviceAdapter Class: Description: A class in the ASM library for bytecode manipulation. Constructors: protected AdviceAdapter(int api, org.objectweb.asm.MethodVisitor methodVisitor, int access, java.lang.String name, java.lang.String descriptor) Description: Constructs a new AdviceAdapter. Parameters: api: int methodVisitor: org.objectweb.asm.MethodVisitor access: int name: java.lang.String descriptor: java.lang.String Methods: protected void onMethodEnter() Description: Generates the "before" advice for the visited method. protected void onMethodExit(int opcode) Description: Generates the "after" advice for the visited method. Parameters: opcode: int void visitCode() Description: Starts the visit of the method's code, if any (i.e. void visitFieldInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String descriptor) Description: Visits a field instruction. Parameters: opcode: int owner: java.lang.String name: java.lang.String descriptor: java.lang.String ``` -------------------------------- ### Simple Java Hello Class Definition Source: https://asm.ow2.io/javadoc/org/objectweb/asm/util/TraceClassVisitor The original Java source code for the 'Hello' class, which serves as an example to demonstrate the `TraceClassVisitor`'s output when processing a simple class. ```Java public class Hello { public static void main(String[] args) { System.out.println("hello"); } } ``` -------------------------------- ### Visit TABLESWITCH Instruction (MethodVisitor) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Documents the `visitTableSwitchInsn` method, used for visiting `TABLESWITCH` instructions. It defines parameters for minimum and maximum key values, a default handler, and an array of labels for handler blocks, facilitating efficient dispatch for contiguous key ranges. ```APIDOC public void visitTableSwitchInsn(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label... labels) Description: Visits a TABLESWITCH instruction. Parameters: min: The minimum key value. max: The maximum key value. dflt: Beginning of the default handler block. labels: Beginnings of the handler blocks. labels[i] is the beginning of the handler block for the min + i key. Overrides: MethodVisitor.visitTableSwitchInsn ``` -------------------------------- ### JavaDoc Search Pattern Examples Source: https://asm.ow2.io/javadoc/help-doc Examples demonstrating how to use abbreviated or camelCase patterns to search for Java API elements within JavaDoc documentation. These patterns are entered into the search box to quickly locate specific declarations, types, fields, or methods. ```APIDOC j.l.obj ``` ```APIDOC InpStr ``` ```APIDOC HM.cK ``` -------------------------------- ### Get JVM Instruction Opcode Adapted to Type Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns a JVM instruction opcode adapted to this `Type`. This method can be used to get the correct opcode for type-specific operations like `ILOAD`, `LLOAD`, `ALOAD`, `ISTORE`, etc., based on the current `Type` instance, simplifying bytecode generation. ```APIDOC int getOpcode(int opcode) ``` -------------------------------- ### ASM Method Visitor Initialization Parameters Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Describes the parameters typically used when initializing an ASM MethodVisitor or a class that adapts it, providing essential metadata for method processing. ```APIDOC Parameters: api: The ASM API version implemented by this visitor. Must be one of the ASM*x values in Opcodes. methodVisitor: The method visitor to which this adapter delegates calls. access: The method's access flags (see Opcodes). name: The method's name. descriptor: The method's descriptor (see Type). ``` -------------------------------- ### Constructor Details: TraceRecordComponentVisitor(Printer printer) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/util/TraceRecordComponentVisitor Constructs a new `TraceRecordComponentVisitor` instance, initializing it with a specified `Printer`. ```APIDOC Constructor: TraceRecordComponentVisitor(Printer printer) Signature: public TraceRecordComponentVisitor(org.objectweb.asm.util.Printer printer) Description: Constructs a new TraceRecordComponentVisitor. Parameters: printer: org.objectweb.asm.util.Printer - the printer to convert the visited record component into text. ``` -------------------------------- ### Get Sort of Type Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns the sort of this type. ```APIDOC Method: getSort() Return Type: int ``` -------------------------------- ### Visit Jump Instruction (MethodVisitor) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Documents the `visitJumpInsn` method, which is used to visit jump instructions in bytecode. It details the `opcode` and `label` parameters, explaining their roles in defining the jump type and target for control flow. ```APIDOC public void visitJumpInsn(int opcode, org.objectweb.asm.Label label) Description: Visits a jump instruction. A jump instruction is an instruction that may jump to another instruction. Parameters: opcode: The opcode of the type instruction to be visited. This opcode is either IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL. label: The operand of the instruction to be visited. This operand is a label that designates the instruction to which the jump instruction may jump. Overrides: MethodVisitor.visitJumpInsn ``` -------------------------------- ### Get Name Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/GeneratorAdapter Returns the name of the entity. ```APIDOC String getName() Returns: The name. ``` -------------------------------- ### Get String Representation of Type Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns a string representation of this type. ```APIDOC Method: toString() Return Type: java.lang.String ``` -------------------------------- ### AdviceAdapter Class Constructor Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Details the constructor for the `AdviceAdapter` class, outlining its parameters and purpose for instantiation. ```APIDOC class AdviceAdapter { protected AdviceAdapter( int api, org.objectweb.asm.MethodVisitor methodVisitor, int access, String name, String descriptor ); // Constructs a new AdviceAdapter class. } ``` -------------------------------- ### Get Type from Class Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns the `Type` corresponding to the given class. ```APIDOC Method: getType(java.lang.Class clazz) Return Type: static org.objectweb.asm.Type Parameters: clazz: java.lang.Class ``` -------------------------------- ### API: MethodVisitor.visitIntInsn Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Documents the `visitIntInsn` method, which handles instructions with a single integer operand. It specifies the valid opcodes (BIPUSH, SIPUSH, NEWARRAY) and the expected range or type for the operand based on the opcode. ```APIDOC public void visitIntInsn(int opcode, int operand) Description: Visits an instruction with a single int operand. Overrides: MethodVisitor.visitIntInsn Parameters: opcode: The opcode of the instruction to be visited. This opcode is either BIPUSH, SIPUSH or NEWARRAY. operand: The operand of the instruction to be visited. When opcode is BIPUSH, operand value should be between Byte.MIN_VALUE and Byte.MAX_VALUE. When opcode is SIPUSH, operand value should be between Short.MIN_VALUE and Short.MAX_VALUE. When opcode is NEWARRAY, operand value should be one of Opcodes.T_BOOLEAN, Opcodes.T_CHAR, Opcodes.T_FLOAT, Opcodes.T_DOUBLE, Opcodes.T_BYTE, Opcodes.T_SHORT, Opcodes.T_INT or Opcodes.T_LONG. ``` -------------------------------- ### Get Size of Type Values Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns the size of values of this type. ```APIDOC Method: getSize() Return Type: int ``` -------------------------------- ### JSRInlinerAdapter Constructor Documentation Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/JSRInlinerAdapter Documents the constructor for the `JSRInlinerAdapter` class, detailing its parameters and purpose. This constructor initializes a new instance of the adapter. ```APIDOC JSRInlinerAdapter: __init__( access: int, name: String, descriptor: String, signature: String, exceptions: String[] ) access: int name: String descriptor: String signature: String exceptions: String[] Description: Constructs a new JSRInlinerAdapter. ``` -------------------------------- ### ModuleVisitor Constructor Details Source: https://asm.ow2.io/javadoc/org/objectweb/asm/ModuleVisitor Documents the constructors for the `ModuleVisitor` class, explaining how to instantiate the class and the parameters required for each constructor. ```APIDOC Constructor: ModuleVisitor(int api) Parameters: api: int - the ASM API version implemented by this visitor. Must be one of Opcodes.ASM6 or Opcodes.ASM7. Constructor: ModuleVisitor(int api, org.objectweb.asm.ModuleVisitor moduleVisitor) Parameters: api: int - the ASM API version implemented by this visitor. Must be one of Opcodes.ASM6 or Opcodes.ASM7. moduleVisitor: org.objectweb.asm.ModuleVisitor - the module visitor to which this visitor must delegate method calls. May be null. ``` -------------------------------- ### Get Return Type Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/GeneratorAdapter Returns the return type of a method. ```APIDOC Type getReturnType() Returns: The return type. ``` -------------------------------- ### Get Hash Code for Type Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns a hash code value for this type. ```APIDOC Method: hashCode() Return Type: int ``` -------------------------------- ### ASM ClassVisitor API Reference Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/SerialVersionUIDAdder This section provides a detailed reference for the ClassVisitor API, focusing on its core methods for bytecode analysis and manipulation. It includes method signatures, return types, and brief descriptions of their purpose, along with a list of inherited methods from parent classes. ```APIDOC Class: ClassVisitor (inferred from context) Methods: visit(version: int, access: int, name: String, signature: String, superName: String, interfaces: String[]): void Description: Visits the header of the class. visitEnd(): void Description: Visits the end of the class. visitField(access: int, name: String, desc: String, signature: String, value: Object): FieldVisitor Description: Visits a field of the class. visitInnerClass(innerClassName: String, outerName: String, innerName: String, innerClassAccess: int): void Description: Visits information about an inner class. visitMethod(access: int, name: String, descriptor: String, signature: String, exceptions: String[]): MethodVisitor Description: Visits a method of the class. Inherited Methods from class org.objectweb.asm.ClassVisitor: getDelegate() visitAnnotation(java.lang.String, boolean) visitAttribute(org.objectweb.asm.Attribute) visitModule(java.lang.String, int, java.lang.String) visitNestHost(java.lang.String) visitNestMember(java.lang.String) visitOuterClass(java.lang.String, java.lang.String, java.lang.String) visitPermittedSubclass(java.lang.String) visitRecordComponent(java.lang.String, java.lang.String, java.lang.String) visitSource(java.lang.String, java.lang.String) visitTypeAnnotation(int, org.objectweb.asm.TypePath, java.lang.String, boolean) Inherited Methods from class java.lang.Object: (Methods inherited from java.lang.Object are not explicitly listed in the provided text, only the class reference.) ``` -------------------------------- ### Get Type from Method Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns the method `Type` corresponding to the given method. ```APIDOC Method: getType(java.lang.reflect.Method method) Return Type: static org.objectweb.asm.Type Parameters: method: java.lang.reflect.Method ``` -------------------------------- ### Generate 'Hello World' Class Bytecode with ASM GeneratorAdapter Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/GeneratorAdapter Demonstrates how to use ASM's `GeneratorAdapter` to programmatically generate the bytecode for a simple 'Hello world!' Java class. This includes defining the class, its constructor, and the `main` method, showcasing the convenience methods provided by `GeneratorAdapter`. ```Java ClassWriter cw = new ClassWriter(0); cw.visit(V1_1, ACC_PUBLIC, "Example", null, "java/lang/Object", null); Method m = Method.getMethod("void ()"); GeneratorAdapter mg = new GeneratorAdapter(ACC_PUBLIC, m, null, null, cw); mg.loadThis(); mg.invokeConstructor(Type.getType(Object.class), m); mg.returnValue(); mg.endMethod(); m = Method.getMethod("void main (String[])"); mg = new GeneratorAdapter(ACC_PUBLIC + ACC_STATIC, m, null, null, cw); mg.getStatic(Type.getType(System.class), "out", Type.getType(PrintStream.class)); mg.push("Hello world!"); mg.invokeVirtual(Type.getType(PrintStream.class), Method.getMethod("void println (String)")); mg.returnValue(); mg.endMethod(); cw.visitEnd(); ``` -------------------------------- ### Get Type from Constructor Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns the method `Type` corresponding to the given constructor. ```APIDOC Method: getType(java.lang.reflect.Constructor constructor) Return Type: static org.objectweb.asm.Type Parameters: constructor: java.lang.reflect.Constructor ``` -------------------------------- ### TraceAnnotationVisitor Constructor Details Source: https://asm.ow2.io/javadoc/org/objectweb/asm/util/TraceAnnotationVisitor Documents the available constructors for the `TraceAnnotationVisitor` class, explaining their parameters and purpose for initializing new instances of the visitor. ```APIDOC TraceAnnotationVisitor: __init__(printer: Printer) printer: the printer to convert the visited annotation into text. __init__(annotationVisitor: AnnotationVisitor, printer: Printer) annotationVisitor: the annotation visitor to which to delegate calls. May be null. printer: the printer to convert the visited annotation into text. ``` -------------------------------- ### Java: Example for Handling Constant Types in visitLdcInsn Source: https://asm.ow2.io/javadoc/org/objectweb/asm/util/TraceMethodVisitor This Java code snippet provides an example implementation for handling different constant types within the `visitLdcInsn` method. It demonstrates a series of `instanceof` checks to identify the specific type of the constant (`cst`), including nested checks for different `Type` sorts, and suggests throwing an exception for unexpected types. ```Java if (cst instanceof Integer) { // ... } else if (cst instanceof Float) { // ... } else if (cst instanceof Long) { // ... } else if (cst instanceof Double) { // ... } else if (cst instanceof String) { // ... } else if (cst instanceof Type) { int sort = ((Type) cst).getSort(); if (sort == Type.OBJECT) { // ... } else if (sort == Type.ARRAY) { // ... } else if (sort == Type.METHOD) { // ... } else { // throw an exception } } else if (cst instanceof Handle) { // ... } else if (cst instanceof ConstantDynamic) { // ... } else { // throw an exception } ``` -------------------------------- ### Visit Jump Instruction (ASM Java API) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Documents the `visitJumpInsn` method, used to visit a jump instruction. This method provides the opcode of the jump instruction and the label it targets. ```APIDOC void visitJumpInsn(int opcode, org.objectweb.asm.Label label) ``` -------------------------------- ### Get Method Name Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/GeneratorAdapter Retrieves the name of the method being adapted by this `GeneratorAdapter`. ```APIDOC Method: getName Signature: public String getName() Description: Returns the name of the adapted method. ``` -------------------------------- ### Documenting visitJumpInsn Method in ASM MethodVisitor Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/JSRInlinerAdapter This API documentation details the `visitJumpInsn` method, which is part of the `MethodVisitor` interface in the ASM bytecode manipulation library. It explains its purpose in visiting jump instructions, lists the various opcode values it can handle, and describes its `opcode` and `label` parameters. ```APIDOC public void visitJumpInsn(int opcode, Label label) Description: Visits a jump instruction. A jump instruction is an instruction that may jump to another instruction. Overrides: visitJumpInsn(int,org.objectweb.asm.Label) in class MethodNode Parameters: opcode: the opcode of the type instruction to be visited. This opcode is either IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL. label: the operand of the instruction to be visited. This operand is a label that designates the instruction to which the jump instruction may jump. ``` -------------------------------- ### Visit LOOKUPSWITCH Instruction (MethodVisitor) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Documents the `visitLookupSwitchInsn` method, used for visiting `LOOKUPSWITCH` instructions. It specifies parameters for the default handler, an array of keys, and corresponding labels for each case, enabling dynamic dispatch based on key values. ```APIDOC public void visitLookupSwitchInsn(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels) Description: Visits a LOOKUPSWITCH instruction. Parameters: dflt: Beginning of the default handler block. keys: The values of the keys. Keys must be sorted in increasing order. labels: Beginnings of the handler blocks. labels[i] is the beginning of the handler block for the keys[i] key. Overrides: MethodVisitor.visitLookupSwitchInsn ``` -------------------------------- ### Get Local Variable Type Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/GeneratorAdapter Returns the type of the given local variable. ```APIDOC Type getLocalType(int local) local: The index of the local variable. Returns: The type of the given local variable. ``` -------------------------------- ### Visit Jump Instruction (visitJumpInsn) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Documents the `visitJumpInsn` method in ASM's `MethodVisitor` class. This method is used to visit a jump instruction, which redirects program flow to a specific label. ```APIDOC Method: visitJumpInsn Signature: public void visitJumpInsn(int opcode, Label label) Description: Visits a jump instruction. Parameters: opcode: The opcode of the jump instruction. label: The target label for the jump instruction. ``` -------------------------------- ### Get Type from Descriptor String Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns the `Type` corresponding to the given type descriptor string. ```APIDOC Method: getType(java.lang.String typeDescriptor) Return Type: static org.objectweb.asm.Type Parameters: typeDescriptor: java.lang.String ``` -------------------------------- ### ModuleProvideNode Class API Reference Source: https://asm.ow2.io/javadoc/org/objectweb/asm/tree/ModuleProvideNode Detailed API documentation for the `org.objectweb.asm.tree.ModuleProvideNode` class, including its fields, constructors, and methods. This class represents a service and its implementation provided by the current module. ```APIDOC Class: ModuleProvideNode Package: org.objectweb.asm.tree Extends: java.lang.Object Description: A node that represents a service and its implementation provided by the current module. Fields: service: Type: String Description: The internal name of the service (see Type.getInternalName()). providers: Type: List Description: The internal names of the implementations of the service (there is at least one provider). See Type.getInternalName(). Constructors: ModuleProvideNode(service: String, providers: List): Description: Constructs a new ModuleProvideNode. Methods: accept(moduleVisitor: ModuleVisitor): void Description: Makes the given module visitor visit this require declaration. Inherited Methods from java.lang.Object: clone(), equals(Object), finalize(), getClass(), hashCode(), notify(), notifyAll(), toString(), wait(), wait(long), wait(long, int) ``` -------------------------------- ### Get Method Return Type Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/GeneratorAdapter Retrieves the return type of the method being adapted by this `GeneratorAdapter`. ```APIDOC Method: getReturnType Signature: public Type getReturnType() Description: Returns the return type of the adapted method. ``` -------------------------------- ### GeneratorAdapter Class Constructors Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/GeneratorAdapter Documentation for the constructors of the `GeneratorAdapter` class, used for initializing instances that help in generating bytecode. ```APIDOC GeneratorAdapter(int access, Method method, String signature, Type[] exceptions, ClassVisitor classVisitor) Constructs a new GeneratorAdapter. ``` ```APIDOC GeneratorAdapter(int access, Method method, MethodVisitor methodVisitor) Constructs a new GeneratorAdapter. ``` ```APIDOC protected GeneratorAdapter(int api, MethodVisitor methodVisitor, int access, String name, String descriptor) Constructs a new GeneratorAdapter. ``` ```APIDOC GeneratorAdapter(MethodVisitor methodVisitor, int access, String name, String descriptor) Constructs a new GeneratorAdapter. ``` -------------------------------- ### Get Method Name (Java) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/Method Retrieves the simple name of the method represented by this `Method` object. ```APIDOC getName: signature: public String getName() Returns: String - The name of the method described by this object. ``` -------------------------------- ### GeneratorAdapter Class API Reference Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Comprehensive API documentation for the `GeneratorAdapter` class, detailing its methods for bytecode generation and manipulation within the ASM framework. This class simplifies common bytecode generation patterns. ```APIDOC GeneratorAdapter: arrayLength() arrayLoad(org.objectweb.asm.Type type) arrayStore(org.objectweb.asm.Type type) box(org.objectweb.asm.Type type) cast(org.objectweb.asm.Type fromType, org.objectweb.asm.Type toType) catchException(org.objectweb.asm.Label start, org.objectweb.asm.Label end, org.objectweb.asm.Type exceptionType) checkCast(org.objectweb.asm.Type type) dup() dup2() dup2X1() dup2X2() dupX1() dupX2() endMethod() getAccess() getArgumentTypes() getField(org.objectweb.asm.Type owner, java.lang.String name, org.objectweb.asm.Type type) getLocalType(int local) getName() getReturnType() getStatic(org.objectweb.asm.Type owner, java.lang.String name, org.objectweb.asm.Type type) goTo(org.objectweb.asm.Label label) ifCmp(org.objectweb.asm.Type type, int mode, org.objectweb.asm.Label label) ifICmp(int mode, org.objectweb.asm.Label label) ifNonNull(org.objectweb.asm.Label label) ifNull(org.objectweb.asm.Label label) ifZCmp(int mode, org.objectweb.asm.Label label) iinc(int local, int amount) instanceOf(org.objectweb.asm.Type type) invokeConstructor(org.objectweb.asm.Type owner, org.objectweb.asm.commons.Method method) invokeDynamic(java.lang.String name, java.lang.String descriptor, org.objectweb.asm.Handle bootstrapMethodHandle, java.lang.Object... bootstrapMethodArguments) invokeInterface(org.objectweb.asm.Type owner, org.objectweb.asm.commons.Method method) invokeStatic(org.objectweb.asm.Type owner, org.objectweb.asm.commons.Method method) invokeVirtual(org.objectweb.asm.Type owner, org.objectweb.asm.commons.Method method) loadArg(int arg) loadArgArray() loadArgs() loadArgs(int arg, int count) loadLocal(int local) loadLocal(int local, org.objectweb.asm.Type type) loadThis() mark() mark(org.objectweb.asm ``` -------------------------------- ### Get Method Access Flags Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/GeneratorAdapter Retrieves the access flags associated with the method being adapted by this `GeneratorAdapter`. ```APIDOC Method: getAccess Signature: public int getAccess() Description: Returns the access flags of the adapted method. ``` -------------------------------- ### Get Return Type of Method Descriptor Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns the `Type` corresponding to the return type of the given method descriptor. ```APIDOC Method: getReturnType() Return Type: org.objectweb.asm.Type ``` -------------------------------- ### ModuleVisitor.accept Method API Documentation Source: https://asm.ow2.io/javadoc/org/objectweb/asm/tree/ModuleRequireNode Detailed API documentation for the `accept` method within the `ModuleVisitor` context, explaining its signature, purpose, and parameters. Also includes general flags related to module dependencies that the method might interact with. ```APIDOC Module Directive Properties: access: The access flag of the dependence among ACC_TRANSITIVE, ACC_STATIC_PHASE, ACC_SYNTHETIC and ACC_MANDATED. version: The module version at compile time, or null. Method Details: accept: Signature: public void accept(ModuleVisitor moduleVisitor) Description: Makes the given module visitor visit this require directive. Parameters: moduleVisitor: a module visitor. ``` -------------------------------- ### Get List Iterator (iterator) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/tree/InsnList Returns a ListIterator over the instructions in this list, allowing sequential access and modification. ```APIDOC public ListIterator iterator() Description: Returns an iterator over the instructions in this list. Specified by: iterator in interface Iterable Returns: an iterator over the instructions in this list. ``` -------------------------------- ### Visit TableSwitch Instruction (ASM Java API) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Documents the `visitTableSwitchInsn` method, used to visit a TABLESWITCH instruction. This method provides the minimum and maximum key values, the default label, and an array of labels for the switch cases. ```APIDOC void visitTableSwitchInsn(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label... labels) ``` -------------------------------- ### Get Method Return Type (Java) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/Method Retrieves the return type of the method represented by this `Method` object. ```APIDOC getReturnType: signature: public Type getReturnType() Returns: Type - The return type of the method described by this object. ``` -------------------------------- ### Visit Integer Instruction (ASM Java API) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AdviceAdapter Documents the `visitIntInsn` method, used to visit an instruction that takes a single integer operand. This includes instructions like BIPUSH, SIPUSH, or NEWARRAY. ```APIDOC void visitIntInsn(int opcode, int operand) ``` -------------------------------- ### Get element value from array in BasicVerifier Source: https://asm.ow2.io/javadoc/org/objectweb/asm/tree/analysis/SimpleVerifier Returns the value corresponding to the type of the elements of the given array reference value. ```APIDOC protected org.objectweb.asm.tree.analysis.BasicValue BasicVerifier.getElementValue(objectArrayValue: org.objectweb.asm.tree.analysis.BasicValue) throws org.objectweb.asm.tree.analysis.AnalyzerException Description copied from class: BasicVerifier.getElementValue(org.objectweb.asm.tree.analysis.BasicValue) Overrides: BasicVerifier.getElementValue(org.objectweb.asm.tree.analysis.BasicValue) Parameters: objectArrayValue: a value corresponding to array of object (or array) references. Returns: the value corresponding to the type of the elements of 'objectArrayValue'. Throws: AnalyzerException: if objectArrayValue does not correspond to an array type. ``` -------------------------------- ### API Documentation for CheckSignatureAdapter Class Source: https://asm.ow2.io/javadoc/org/objectweb/asm/util/package-summary Details the purpose and inheritance/usage of the `CheckSignatureAdapter` class within the `org.objectweb.asm.util` package. This adapter ensures proper usage of `SignatureVisitor` methods. ```APIDOC Class: CheckSignatureAdapter Description: A SignatureVisitor that checks that its methods are properly used. ``` -------------------------------- ### MethodVisitor Constructor Details Source: https://asm.ow2.io/javadoc/org/objectweb/asm/MethodVisitor Describes the constructors available for the `MethodVisitor` class, outlining their parameters and how to instantiate a `MethodVisitor` object. It includes constructors for different initialization needs. ```APIDOC Constructor Details: MethodVisitor(int api): Signature: protected MethodVisitor(int api) Parameters: api: Type: int Description: the ASM API version implemented by this visitor. Must be one of the `ASM`*x* values in `Opcodes`. MethodVisitor(int api, MethodVisitor methodVisitor): Signature: protected MethodVisitor(int api, MethodVisitor methodVisitor) Parameters: api: Type: int Description: the ASM API version implemented by this visitor. Must be one of the `ASM`*x* values in `Opcodes`. methodVisitor: Type: MethodVisitor Description: the method visitor to which this visitor must delegate method calls. May be null. ``` -------------------------------- ### Get Method Descriptor (Java) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/Method Retrieves the descriptor of the method represented by this `Method` object, as defined by the JVM specification. ```APIDOC getDescriptor: signature: public String getDescriptor() Returns: String - The descriptor of the method described by this object. ``` -------------------------------- ### API Documentation for TraceRecordComponentVisitor Class Source: https://asm.ow2.io/javadoc/org/objectweb/asm/util/package-summary Details the purpose and inheritance/usage of the `TraceRecordComponentVisitor` class within the `org.objectweb.asm.util` package. This `RecordComponentVisitor` prints visited record components using a `Printer`. ```APIDOC Class: TraceRecordComponentVisitor Description: A RecordComponentVisitor that prints the record components it visits with a Printer. ``` -------------------------------- ### Get Method Name Source: https://asm.ow2.io/javadoc/org/objectweb/asm/MethodTooLargeException Retrieves the name of the method. This method is part of the core API for inspecting method properties. ```APIDOC getMethodName(): Signature: public String getMethodName() Description: Returns the name of the method. Returns: the name of the method. ``` -------------------------------- ### MethodVisitor.visitCode Method Source: https://asm.ow2.io/javadoc/org/objectweb/asm/tree/MethodNode Starts the visit of the method's code, if the method is not abstract. This method is an override from the `MethodVisitor` class. ```APIDOC public void visitCode() Description: Starts the visit of the method's code, if any (i.e. non abstract method). Overrides: MethodVisitor.visitCode() ``` -------------------------------- ### StaticInitMerger Class API Documentation Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/package-summary Documents the `StaticInitMerger` class, a `ClassVisitor` implementation designed to merge multiple `` (static initializer) methods into a single method within a class. ```APIDOC StaticInitMerger: type: class package: org.objectweb.asm.commons description: A ClassVisitor that merges methods into a single one. ``` -------------------------------- ### API: visitIntInsn Method Source: https://asm.ow2.io/javadoc/org/objectweb/asm/MethodVisitor Visits an instruction with a single int operand. Examples include BIPUSH, SIPUSH, or NEWARRAY. ```APIDOC void visitIntInsn(int opcode, int operand) ``` -------------------------------- ### ModuleProvideNode.accept Method Documentation Source: https://asm.ow2.io/javadoc/org/objectweb/asm/tree/ModuleProvideNode Documents the `accept` method of the `ModuleProvideNode` class. This method is responsible for making the given `ModuleVisitor` visit the require declaration represented by this node. ```APIDOC public void accept(ModuleVisitor moduleVisitor) Description: Makes the given module visitor visit this require declaration. Parameters: moduleVisitor: ModuleVisitor - a module visitor. ``` -------------------------------- ### Get Instruction Type (ASM AbstractInsnNode) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/tree/InsnNode Returns the type of the instruction. This method is specified by and overrides `AbstractInsnNode.getType()` from the `org.objectweb.asm.tree` package. ```APIDOC Method: getType Signature: public int getType() Description: Returns the type of this instruction. Specified By: AbstractInsnNode.getType() Returns: Type: int Description: the type of this instruction, i.e. one the constants defined in this class. ``` -------------------------------- ### API Documentation for CheckModuleAdapter Class Source: https://asm.ow2.io/javadoc/org/objectweb/asm/util/package-summary Details the purpose and inheritance/usage of the `CheckModuleAdapter` class within the `org.objectweb.asm.util` package. This adapter ensures proper usage of `ModuleVisitor` methods. ```APIDOC Class: CheckModuleAdapter Description: A ModuleVisitor that checks that its methods are properly used. ``` -------------------------------- ### Get Method Argument Types Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/GeneratorAdapter Retrieves an array of `Type` objects representing the argument types of the method being adapted by this `GeneratorAdapter`. ```APIDOC Method: getArgumentTypes Signature: public Type[] getArgumentTypes() Description: Returns the argument types of the adapted method. ``` -------------------------------- ### ASM RecordComponentVisitor API Methods Source: https://asm.ow2.io/javadoc/org/objectweb/asm/util/TraceRecordComponentVisitor Detailed API documentation for key methods within the `RecordComponentVisitor` class, outlining their signatures, parameters, return types, and purpose. ```APIDOC RecordComponentVisitor: visitAnnotation(descriptor: String, visible: boolean): AnnotationVisitor descriptor: The class descriptor of the annotation class. visible: True if the annotation is visible at runtime. Returns: A visitor to visit the annotation values, or null if this visitor is not interested in visiting this annotation. visitAttribute(attribute: Attribute): void attribute: An attribute. Description: Visits a non standard attribute of the record component. visitEnd(): void Description: Visits the end of the record component. This method, which is the last one to be called, is used to inform the visitor that everything have been visited. ``` -------------------------------- ### Get Hash Code for Type Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns a hash code value for this type instance. This method overrides the default `hashCode` method from `java.lang.Object`. ```APIDOC public int hashCode() Returns: a hash code value for this type. Overrides: Object.hashCode ``` -------------------------------- ### Get Return Type by Method Descriptor String Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Determines the 'Type' object corresponding to the return type specified in a method descriptor string. ```APIDOC getReturnType: public static Type getReturnType(String methodDescriptor) methodDescriptor: a method descriptor. Returns: the Type corresponding to the return type of the given method descriptor. ``` -------------------------------- ### IincInsnNode Class API Reference Source: https://asm.ow2.io/javadoc/org/objectweb/asm/tree/IincInsnNode Comprehensive API documentation for the `IincInsnNode` class, detailing its fields, constructor, and methods. This includes information on parameters, return types, and descriptions for each member. ```APIDOC Class: IincInsnNode Inherited Methods (from java.lang.Object): clone() equals(Object) finalize() getClass() hashCode() notify() notifyAll() toString() wait() wait(long) wait(long, int) Field Details: var: public int Description: Index of the local variable to be incremented. incr: public int Description: Amount to increment the local variable by. Constructor Details: IincInsnNode(int varIndex, int incr) Description: Constructs a new IincInsnNode. Parameters: varIndex: int - index of the local variable to be incremented. incr: int - increment amount to increment the local variable by. Method Details: getType(): public int Description: Returns the type of this instruction. (Description copied from class: AbstractInsnNode) Returns: int - the type of this instruction, i.e. one the constants defined in this class. accept(MethodVisitor methodVisitor): public void Description: Makes the given method visitor visit this instruction. (Description copied from class: AbstractInsnNode) Parameters: methodVisitor: MethodVisitor - a method visitor. clone(Map clonedLabels): public AbstractInsnNode Description: Returns a copy of this instruction. (Description copied from class: AbstractInsnNode) Parameters: clonedLabels: Map - a map from LabelNodes to cloned LabelNodes. Returns: AbstractInsnNode - a copy of this instruction. The returned instruction does not belong to any InsnList. ``` -------------------------------- ### API Documentation for visitJumpInsn Method Source: https://asm.ow2.io/javadoc/org/objectweb/asm/commons/AnalyzerAdapter Documents the visitJumpInsn method of the MethodVisitor class, which handles jump instructions in bytecode. It specifies parameters for the opcode and the target label, essential for controlling program flow. ```APIDOC MethodVisitor: visitJumpInsn(opcode: int, label: Label): void Description: Visits a jump instruction. A jump instruction is an instruction that may jump to another instruction. opcode: the opcode of the jump instruction. label: the label to which the instruction jumps. ``` -------------------------------- ### Get String Representation of Type Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns a string representation of this type instance, typically its descriptor. This method overrides the default `toString` method from `java.lang.Object`. ```APIDOC public String toString() Returns: the descriptor of this type. Overrides: Object.toString ``` -------------------------------- ### Get Class Name of a Type Instance Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Returns the binary name of the class that corresponds to this 'Type' instance. This method is not applicable and should not be used for method types. ```APIDOC getClassName: public String getClassName() Returns: the binary name of the class corresponding to this type. ``` -------------------------------- ### Main Entry Point (Java Application) Source: https://asm.ow2.io/javadoc/org/objectweb/asm/util/CheckClassAdapter Documents the standard `main` method, serving as the entry point for a Java application. It accepts command-line arguments and may throw an `IOException`. ```APIDOC Method: public static void main(String[] args) Parameters: args: String[] - Command-line arguments passed to the application. Throws: IOException ``` -------------------------------- ### Get Return Type by Java Reflection Method Source: https://asm.ow2.io/javadoc/org/objectweb/asm/Type Obtains the 'Type' object representing the return type of a given Java reflection 'Method' object. ```APIDOC getReturnType: public static Type getReturnType(java.lang.reflect.Method method) method: a method. Returns: the Type corresponding to the return type of the given method. ```