/** * Makes the given visitor visit this stack map frame. * * @param mv a method visitor. */ public void accept(final MethodVisitor mv) { switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: mv.visitFrame(type, local.size(), asArray(local), stack.size(), asArray(stack)); break; case Opcodes.F_APPEND: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_CHOP: mv.visitFrame(type, local.size(), asArray(local), 0, null); break; case Opcodes.F_SAME: mv.visitFrame(type, 0, null, 0, null); break; case Opcodes.F_SAME1: mv.visitFrame(type, 0, null, 1, asArray(stack)); break; } }
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { if ((Opcodes.ACC_PUBLIC & access) == 0 || EXCLUDE_METHODS.contains(name) || name.contains("<")) { return null; } if (name.endsWith("0")) { name = name.substring(0, name.length() - 1); } int index = -1; for (int i = 0; i < name.length(); i++) { if (Character.isUpperCase(name.charAt(i))) { index = i; break; } } if (index < 0) { return new FindEnumVisitor(name, name.toUpperCase(), null); } else { String cmd = name.substring(0, index).toUpperCase(); return new FindEnumVisitor(name, cmd, name.substring(index).toUpperCase()); } }
public LocalVariablesSorter( final int access, final String desc, final MethodVisitor mv) { super(mv); state = new State(); Type[] args = Type.getArgumentTypes(desc); state.nextLocal = ((Opcodes.ACC_STATIC & access) != 0) ? 0 : 1; for (int i = 0; i < args.length; i++) { state.nextLocal += args[i].getSize(); } firstLocal = state.nextLocal; }
public MethodVisitor visitMethod( final int access, final String name, final String desc, final String signature, final String[] exceptions) { MethodNode mn = new MethodNode(access, name, desc, signature, exceptions); methods.add(mn); return mn; }
/** * Makes the given visitor visit this local variable declaration. * * @param mv a method visitor. */ public void accept(final MethodVisitor mv) { mv.visitLocalVariable(name, desc, signature, start.getLabel(), end.getLabel(), index); }
/** * Makes the given visitor visit all of the instructions in this list. * * @param mv the method visitor that must visit the instructions. */ public void accept(final MethodVisitor mv) { AbstractInsnNode insn = first; while (insn != null) { insn.accept(mv); insn = insn.next; } }
public void accept(final MethodVisitor mv) { int[] keys = new int[this.keys.size()]; for (int i = 0; i < keys.length; ++i) { keys[i] = ((Integer) this.keys.get(i)).intValue(); } Label[] labels = new Label[this.labels.size()]; for (int i = 0; i < labels.length; ++i) { labels[i] = ((LabelNode) this.labels.get(i)).getLabel(); } mv.visitLookupSwitchInsn(dflt.getLabel(), keys, labels); }
/** * Makes the given class visitor visit this method. * * @param cv a class visitor. */ public void accept(final ClassVisitor cv) { String[] exceptions = new String[this.exceptions.size()]; this.exceptions.toArray(exceptions); MethodVisitor mv = cv.visitMethod(access, name, desc, signature, exceptions); if (mv != null) { accept(mv); } }
public void accept(final MethodVisitor mv) { Label[] labels = new Label[this.labels.size()]; for (int i = 0; i < labels.length; ++i) { labels[i] = ((LabelNode) this.labels.get(i)).getLabel(); } mv.visitTableSwitchInsn(min, max, dflt.getLabel(), labels); }
public MethodVisitor visitMethod( final int access, final String name, final String desc, final String signature, final String[] exceptions) { checkState(); checkAccess(access, Opcodes.ACC_PUBLIC + Opcodes.ACC_PRIVATE + Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL + Opcodes.ACC_SYNCHRONIZED + Opcodes.ACC_BRIDGE + Opcodes.ACC_VARARGS + Opcodes.ACC_NATIVE + Opcodes.ACC_ABSTRACT + Opcodes.ACC_STRICT + Opcodes.ACC_SYNTHETIC + Opcodes.ACC_DEPRECATED); CheckMethodAdapter.checkMethodIdentifier(name, "method name"); CheckMethodAdapter.checkMethodDesc(desc); if (signature != null) { CheckMethodAdapter.checkMethodSignature(signature); } if (exceptions != null) { for (int i = 0; i < exceptions.length; ++i) { CheckMethodAdapter.checkInternalName(exceptions[i], "exception name at index " + i); } } return new CheckMethodAdapter(cv.visitMethod(access, name, desc, signature, exceptions)); }
public MethodVisitor visitMethod( final int access, final String name, final String desc, final String signature, final String[] exceptions) { buf.setLength(0); buf.append("{\n"); buf.append("mv = cw.visitMethod("); appendAccess(access); buf.append(", "); appendConstant(name); buf.append(", "); appendConstant(desc); buf.append(", "); appendConstant(signature); buf.append(", "); if (exceptions != null && exceptions.length > 0) { buf.append("new String[] {"); for (int i = 0; i < exceptions.length; ++i) { buf.append(i == 0 ? " " : ", "); appendConstant(exceptions[i]); } buf.append(" }"); } else { buf.append("null"); } buf.append(");\n"); text.add(buf.toString()); ASMifierMethodVisitor acv = createASMifierMethodVisitor(); text.add(acv.getText()); text.add("}\n"); return acv; }
/** * Makes the given visitor visit this try catch block. * * @param mv a method visitor. */ public void accept(final MethodVisitor mv) { mv.visitTryCatchBlock(start.getLabel(), end.getLabel(), handler == null ? null : handler.getLabel(), type); }
public void accept(final MethodVisitor mv) { mv.visitTypeInsn(opcode, desc); }
public void accept(final MethodVisitor mv) { mv.visitMethodInsn(opcode, owner, name, desc); }
public void accept(final MethodVisitor mv) { mv.visitIntInsn(opcode, operand); }
public void accept(final MethodVisitor cv) { cv.visitFieldInsn(opcode, owner, name, desc); }
public void accept(final MethodVisitor mv) { mv.visitLdcInsn(cst); }
public void accept(final MethodVisitor mv) { mv.visitVarInsn(opcode, var); }
public void accept(final MethodVisitor mv) { mv.visitJumpInsn(opcode, label.getLabel()); }
public void accept(final MethodVisitor mv) { mv.visitIincInsn(var, incr); }