protected String printVarInsnNode(VarInsnNode vin, ListIterator<?> it) { StringBuilder sb = new StringBuilder(); sb.append(nameOpcode(vin.opcode())); sb.append(vin.var); if (Decompiler.BYTECODE.getSettings().isSelected(ClassNodeDecompiler.Settings.DEBUG_HELPERS)) { if (vin.var == 0 && !Modifier.isStatic(mNode.access)) { sb.append(" // reference to self"); } else { final int refIndex = vin.var - (Modifier.isStatic(mNode.access) ? 0 : 1); if (refIndex >= 0 && refIndex < args.length - 1) { sb.append(" // reference to " + args[refIndex].name); } } } return sb.toString(); }
/** * Creates the print * * @return The print as an ArrayList */ public ArrayList<String> createPrint() { ArrayList<String> info = new ArrayList<String>(); ListIterator<?> it = mNode.instructions.iterator(); boolean firstLabel = false; while (it.hasNext()) { AbstractInsnNode ain = (AbstractInsnNode) it.next(); String line = ""; if (ain instanceof VarInsnNode) { line = printVarInsnNode((VarInsnNode) ain, it); } else if (ain instanceof IntInsnNode) { line = printIntInsnNode((IntInsnNode) ain, it); } else if (ain instanceof FieldInsnNode) { line = printFieldInsnNode((FieldInsnNode) ain, it); } else if (ain instanceof MethodInsnNode) { line = printMethodInsnNode((MethodInsnNode) ain, it); } else if (ain instanceof LdcInsnNode) { line = printLdcInsnNode((LdcInsnNode) ain, it); } else if (ain instanceof InsnNode) { line = printInsnNode((InsnNode) ain, it); } else if (ain instanceof JumpInsnNode) { line = printJumpInsnNode((JumpInsnNode) ain, it); } else if (ain instanceof LineNumberNode) { line = printLineNumberNode((LineNumberNode) ain, it); } else if (ain instanceof LabelNode) { if (firstLabel && Decompiler.BYTECODE .getSettings() .isSelected(ClassNodeDecompiler.Settings.APPEND_BRACKETS_TO_LABELS)) info.add("}"); line = printLabelnode((LabelNode) ain); if (Decompiler.BYTECODE .getSettings() .isSelected(ClassNodeDecompiler.Settings.APPEND_BRACKETS_TO_LABELS)) { if (!firstLabel) firstLabel = true; line += " {"; } } else if (ain instanceof TypeInsnNode) { line = printTypeInsnNode((TypeInsnNode) ain); } else if (ain instanceof FrameNode) { line = ""; } else if (ain instanceof IincInsnNode) { line = printIincInsnNode((IincInsnNode) ain); } else if (ain instanceof TableSwitchInsnNode) { line = printTableSwitchInsnNode((TableSwitchInsnNode) ain); } else if (ain instanceof LookupSwitchInsnNode) { line = printLookupSwitchInsnNode((LookupSwitchInsnNode) ain); } else if (ain instanceof InvokeDynamicInsnNode) { line = printInvokeDynamicInsNode((InvokeDynamicInsnNode) ain); } else { line += "UNADDED OPCODE: " + nameOpcode(ain.opcode()) + " " + ain.toString(); } if (!line.equals("")) { if (match) if (matchedInsns.contains(ain)) line = " -> " + line; info.add(line); } } if (firstLabel && Decompiler.BYTECODE .getSettings() .isSelected(ClassNodeDecompiler.Settings.APPEND_BRACKETS_TO_LABELS)) info.add("}"); return info; }