Class BytecodeUtils


  • public class BytecodeUtils
    extends Object
    utility class for common bytecode operations
    Author:
    Stuart Douglas
    • Method Detail

      • addLoadInstruction

        public static void addLoadInstruction​(org.jboss.classfilewriter.code.CodeAttribute code,
                                              String type,
                                              int variable)
        Adds the correct load instruction based on the type descriptor
        Parameters:
        code - the bytecode to add the instruction to
        type - the type of the variable
        variable - the variable number
      • pushClassType

        public static void pushClassType​(org.jboss.classfilewriter.code.CodeAttribute b,
                                         String classType)
        Pushes a class type onto the stack from the string representation This can also handle primitives
        Parameters:
        b - the bytecode
        classType - the type descriptor for the class or primitive to push. This will accept both the java.lang.Object form and the Ljava/lang/Object; form
      • getName

        public static String getName​(String descriptor)