Search in sources :

Example 1 with ASMifier

use of org.objectweb.asm.util.ASMifier in project CodeChickenLib by Chicken-Bones.

the class ASMHelper method dump.

public static void dump(Acceptor acceptor, File file, boolean filterImportant, boolean sortLocals, boolean textify) {
    try {
        if (!file.getParentFile().exists())
            file.getParentFile().mkdirs();
        if (!file.exists())
            file.createNewFile();
        PrintWriter pout = new PrintWriter(file);
        ClassVisitor cv = new TraceClassVisitor(null, textify ? new Textifier() : new ASMifier(), pout);
        if (filterImportant)
            cv = new ImportantInsnVisitor(cv);
        if (sortLocals)
            cv = new LocalVariablesSorterVisitor(cv);
        acceptor.accept(cv);
        pout.close();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : ASMifier(org.objectweb.asm.util.ASMifier) TraceClassVisitor(org.objectweb.asm.util.TraceClassVisitor) TraceClassVisitor(org.objectweb.asm.util.TraceClassVisitor) ClassVisitor(org.objectweb.asm.ClassVisitor) IOException(java.io.IOException) Textifier(org.objectweb.asm.util.Textifier) PrintWriter(java.io.PrintWriter)

Aggregations

IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 ClassVisitor (org.objectweb.asm.ClassVisitor)1 ASMifier (org.objectweb.asm.util.ASMifier)1 Textifier (org.objectweb.asm.util.Textifier)1 TraceClassVisitor (org.objectweb.asm.util.TraceClassVisitor)1