diff --git a/src/main/java/club/bytecode/the/jda/decompilers/bytecode/InstructionPrinter.java b/src/main/java/club/bytecode/the/jda/decompilers/bytecode/InstructionPrinter.java index dcfedea..c2ff402 100644 --- a/src/main/java/club/bytecode/the/jda/decompilers/bytecode/InstructionPrinter.java +++ b/src/main/java/club/bytecode/the/jda/decompilers/bytecode/InstructionPrinter.java @@ -17,13 +17,13 @@ * @author Bibl */ public class InstructionPrinter { - private final MethodNodeDecompiler parent; + protected final MethodNodeDecompiler parent; /** * The MethodNode to print **/ - protected MethodNode mNode; - private TypeAndName[] args; + protected final MethodNode mNode; + protected final TypeAndName[] args; protected int[] pattern; protected boolean match; diff --git a/src/main/java/club/bytecode/the/jda/decompilers/bytecode/MethodNodeDecompiler.java b/src/main/java/club/bytecode/the/jda/decompilers/bytecode/MethodNodeDecompiler.java index 72d6860..ef84168 100644 --- a/src/main/java/club/bytecode/the/jda/decompilers/bytecode/MethodNodeDecompiler.java +++ b/src/main/java/club/bytecode/the/jda/decompilers/bytecode/MethodNodeDecompiler.java @@ -15,10 +15,11 @@ */ public class MethodNodeDecompiler { - private final BytecodeDecompiler parent; + protected final BytecodeDecompiler parent; protected final PrefixedStringBuilder sb; protected final MethodNode mn; protected final ClassNode cn; + protected boolean printDetailedMetadata = true; public MethodNodeDecompiler(BytecodeDecompiler parent, PrefixedStringBuilder sb, MethodNode mn, ClassNode cn) { this.parent = parent; @@ -134,31 +135,33 @@ else if (mn.name.equals("")) InstructionPrinter insnPrinter = getInstructionPrinter(mn, args); - addAttrList(mn.attrs, "attr", sb, insnPrinter); - addAttrList(mn.invisibleAnnotations, "invisAnno", sb, insnPrinter); - addAttrList(mn.invisibleAnnotations, "invisLocalVarAnno", sb, insnPrinter); - addAttrList(mn.invisibleTypeAnnotations, "invisTypeAnno", sb, insnPrinter); - addAttrList(mn.localVariables, "localVar", sb, insnPrinter); - addAttrList(mn.visibleAnnotations, "visAnno", sb, insnPrinter); - addAttrList(mn.visibleLocalVariableAnnotations, "visLocalVarAnno", sb, insnPrinter); - addAttrList(mn.visibleTypeAnnotations, "visTypeAnno", sb, insnPrinter); - - // Exception table - for (Object o : mn.tryCatchBlocks) { - TryCatchBlockNode tcbn = (TryCatchBlockNode) o; - sb.append(" "); - sb.append("TryCatch: L"); - sb.append(insnPrinter.resolveLabel(tcbn.start)); - sb.append(" to L"); - sb.append(insnPrinter.resolveLabel(tcbn.end)); - sb.append(" handled by L"); - sb.append(insnPrinter.resolveLabel(tcbn.handler)); - sb.append(": "); - if (tcbn.type != null) - sb.append(tcbn.type); - else - sb.append("Type is null."); - sb.append(JDA.nl); + if (printDetailedMetadata) { + addAttrList(mn.attrs, "attr", sb, insnPrinter); + addAttrList(mn.invisibleAnnotations, "invisAnno", sb, insnPrinter); + addAttrList(mn.invisibleAnnotations, "invisLocalVarAnno", sb, insnPrinter); + addAttrList(mn.invisibleTypeAnnotations, "invisTypeAnno", sb, insnPrinter); + addAttrList(mn.localVariables, "localVar", sb, insnPrinter); + addAttrList(mn.visibleAnnotations, "visAnno", sb, insnPrinter); + addAttrList(mn.visibleLocalVariableAnnotations, "visLocalVarAnno", sb, insnPrinter); + addAttrList(mn.visibleTypeAnnotations, "visTypeAnno", sb, insnPrinter); + + // Exception table + for (Object o : mn.tryCatchBlocks) { + TryCatchBlockNode tcbn = (TryCatchBlockNode) o; + sb.append(" "); + sb.append("TryCatch: L"); + sb.append(insnPrinter.resolveLabel(tcbn.start)); + sb.append(" to L"); + sb.append(insnPrinter.resolveLabel(tcbn.end)); + sb.append(" handled by L"); + sb.append(insnPrinter.resolveLabel(tcbn.handler)); + sb.append(": "); + if (tcbn.type != null) + sb.append(tcbn.type); + else + sb.append("Type is null."); + sb.append(JDA.nl); + } } // Instructions @@ -269,4 +272,8 @@ boolean createDescriptors() { boolean appendHandlerComments() { return parent.getSettings().getEntry("append-handler-comments").getBool(); } + + public BytecodeDecompiler getParent() { + return parent; + } }