Class BCELifier

  • All Implemented Interfaces:
    Visitor

    public class BCELifier
    extends EmptyVisitor
    This class takes a given JavaClass object and converts it to a Java program that creates that very class using BCEL. This gives new users of BCEL a useful example showing how things are done with BCEL. It does not cover all features of BCEL, but tries to mimic hand-written code as close as possible.
    • Field Detail

      • BASE_PACKAGE

        private static final java.lang.String BASE_PACKAGE
      • CONSTANT_PREFIX

        private static final java.lang.String CONSTANT_PREFIX
      • printWriter

        private final java.io.PrintWriter printWriter
    • Constructor Detail

      • BCELifier

        public BCELifier​(JavaClass clazz,
                         java.io.OutputStream out)
        Constructs a new instance.
        Parameters:
        clazz - Java class to "decompile".
        out - where to print the Java program in UTF-8.
    • Method Detail

      • getJavaClass

        static JavaClass getJavaClass​(java.lang.String name)
                               throws java.lang.ClassNotFoundException,
                                      java.io.IOException
        Throws:
        java.lang.ClassNotFoundException
        java.io.IOException
      • main

        public static void main​(java.lang.String[] argv)
                         throws java.lang.Exception
        Default main method
        Throws:
        java.lang.Exception
      • printArgumentTypes

        static java.lang.String printArgumentTypes​(Type[] argTypes)
      • printFlags

        static java.lang.String printFlags​(int flags)
      • printFlags

        public static java.lang.String printFlags​(int flags,
                                                  BCELifier.FLAGS location)
        Return a string with the flag settings
        Parameters:
        flags - the flags field to interpret
        location - the item type
        Returns:
        the formatted string
        Since:
        6.0 made public
      • printType

        static java.lang.String printType​(java.lang.String signature)
      • printType

        static java.lang.String printType​(Type type)
      • printCreate

        private void printCreate()
      • printMain

        private void printMain()
      • start

        public void start()
        Start Java code generation
      • visitStackMapTypeArray

        private void visitStackMapTypeArray​(StackMapType[] types)