|
15 | 15 | */ |
16 | 16 |
|
17 | 17 | public class MethodNodeDecompiler { |
18 | | - private final BytecodeDecompiler parent; |
| 18 | + protected final BytecodeDecompiler parent; |
19 | 19 | protected final PrefixedStringBuilder sb; |
20 | 20 | protected final MethodNode mn; |
21 | 21 | protected final ClassNode cn; |
| 22 | + protected boolean printDetailedMetadata = true; |
22 | 23 |
|
23 | 24 | public MethodNodeDecompiler(BytecodeDecompiler parent, PrefixedStringBuilder sb, MethodNode mn, ClassNode cn) { |
24 | 25 | this.parent = parent; |
@@ -134,31 +135,33 @@ else if (mn.name.equals("<init>")) |
134 | 135 |
|
135 | 136 | InstructionPrinter insnPrinter = getInstructionPrinter(mn, args); |
136 | 137 |
|
137 | | - addAttrList(mn.attrs, "attr", sb, insnPrinter); |
138 | | - addAttrList(mn.invisibleAnnotations, "invisAnno", sb, insnPrinter); |
139 | | - addAttrList(mn.invisibleAnnotations, "invisLocalVarAnno", sb, insnPrinter); |
140 | | - addAttrList(mn.invisibleTypeAnnotations, "invisTypeAnno", sb, insnPrinter); |
141 | | - addAttrList(mn.localVariables, "localVar", sb, insnPrinter); |
142 | | - addAttrList(mn.visibleAnnotations, "visAnno", sb, insnPrinter); |
143 | | - addAttrList(mn.visibleLocalVariableAnnotations, "visLocalVarAnno", sb, insnPrinter); |
144 | | - addAttrList(mn.visibleTypeAnnotations, "visTypeAnno", sb, insnPrinter); |
145 | | - |
146 | | - // Exception table |
147 | | - for (Object o : mn.tryCatchBlocks) { |
148 | | - TryCatchBlockNode tcbn = (TryCatchBlockNode) o; |
149 | | - sb.append(" "); |
150 | | - sb.append("TryCatch: L"); |
151 | | - sb.append(insnPrinter.resolveLabel(tcbn.start)); |
152 | | - sb.append(" to L"); |
153 | | - sb.append(insnPrinter.resolveLabel(tcbn.end)); |
154 | | - sb.append(" handled by L"); |
155 | | - sb.append(insnPrinter.resolveLabel(tcbn.handler)); |
156 | | - sb.append(": "); |
157 | | - if (tcbn.type != null) |
158 | | - sb.append(tcbn.type); |
159 | | - else |
160 | | - sb.append("Type is null."); |
161 | | - sb.append(JDA.nl); |
| 138 | + if (printDetailedMetadata) { |
| 139 | + addAttrList(mn.attrs, "attr", sb, insnPrinter); |
| 140 | + addAttrList(mn.invisibleAnnotations, "invisAnno", sb, insnPrinter); |
| 141 | + addAttrList(mn.invisibleAnnotations, "invisLocalVarAnno", sb, insnPrinter); |
| 142 | + addAttrList(mn.invisibleTypeAnnotations, "invisTypeAnno", sb, insnPrinter); |
| 143 | + addAttrList(mn.localVariables, "localVar", sb, insnPrinter); |
| 144 | + addAttrList(mn.visibleAnnotations, "visAnno", sb, insnPrinter); |
| 145 | + addAttrList(mn.visibleLocalVariableAnnotations, "visLocalVarAnno", sb, insnPrinter); |
| 146 | + addAttrList(mn.visibleTypeAnnotations, "visTypeAnno", sb, insnPrinter); |
| 147 | + |
| 148 | + // Exception table |
| 149 | + for (Object o : mn.tryCatchBlocks) { |
| 150 | + TryCatchBlockNode tcbn = (TryCatchBlockNode) o; |
| 151 | + sb.append(" "); |
| 152 | + sb.append("TryCatch: L"); |
| 153 | + sb.append(insnPrinter.resolveLabel(tcbn.start)); |
| 154 | + sb.append(" to L"); |
| 155 | + sb.append(insnPrinter.resolveLabel(tcbn.end)); |
| 156 | + sb.append(" handled by L"); |
| 157 | + sb.append(insnPrinter.resolveLabel(tcbn.handler)); |
| 158 | + sb.append(": "); |
| 159 | + if (tcbn.type != null) |
| 160 | + sb.append(tcbn.type); |
| 161 | + else |
| 162 | + sb.append("Type is null."); |
| 163 | + sb.append(JDA.nl); |
| 164 | + } |
162 | 165 | } |
163 | 166 |
|
164 | 167 | // Instructions |
@@ -269,4 +272,8 @@ boolean createDescriptors() { |
269 | 272 | boolean appendHandlerComments() { |
270 | 273 | return parent.getSettings().getEntry("append-handler-comments").getBool(); |
271 | 274 | } |
| 275 | + |
| 276 | + public BytecodeDecompiler getParent() { |
| 277 | + return parent; |
| 278 | + } |
272 | 279 | } |
0 commit comments