void removeInsts(MethodNode m, MethodInsnNode mn, int pSize) { // remove args for (int i = 0; i < pSize; i++) { m.instructions.remove(mn.getPrevious()); } // remove INVOKESTATIC m.instructions.remove(mn); }
private Integer statusCodeFor(MethodInsnNode node) { if (node.name.equals("noContent")) { return 204; } if (node.name.equals("with")) { AbstractInsnNode previous = node.getPrevious(); if (previous instanceof IntInsnNode) { return ((IntInsnNode) previous).operand; } if (previous instanceof FieldInsnNode) { String owner = ((FieldInsnNode) previous).owner.replace("/", "."); if (owner.equals(Status.class.getName())) { String statusName = ((FieldInsnNode) previous).name; return Try.apply(() -> Status.class.getDeclaredField(statusName).get(null)) .map(it -> ((Status) it).value()) .orElse(null); } } } return null; }
public static List<LdcInsnNode> ldcFor(MethodInsnNode node) { AbstractInsnNode it = new Insn<>(null, node.getPrevious()) .prev() .filter(is(MethodInsnNode.class)) .findFirst() .orElseGet(() -> Insn.first(node)); /** Collect all ldc between a previous method invocation and current invocation: */ List<LdcInsnNode> ldc = new ArrayList<>(); while (it != node) { if (it instanceof LdcInsnNode) { ldc.add((LdcInsnNode) it); } it = it.getNext(); } return ldc; } }
if (patterns.size() == 0) { if (method.owner.equals("org/jooby/Kooby")) { if (method.getPrevious() instanceof TypeInsnNode) {
&& handle.getTag() != Opcodes.H_INVOKESTATIC)) { start = new Insn<>(null, method.getPrevious()) .prev() .filter(Filters.is(MethodInsnNode.class))
.orElseGet(() -> { return new Insn<>(method, it.node.getPrevious()) .prev() .filter(is(MethodInsnNode.class))
AbstractInsnNode prev = node.getPrevious(); if (prev instanceof FieldInsnNode && ((MethodInsnNode) n).name.equals("toEnum")) {
AbstractInsnNode curr = method.getPrevious(); boolean foundFrame = false; while (curr != null) {
AbstractInsnNode curr = method.getPrevious(); boolean foundFrame = false; while (curr != null) {
instructions.remove(methodInsn.getPrevious()); // ALOAD
assert size >= 1; for (AbstractInsnNode n = m.getPrevious(); n != null; n = n.getPrevious()) { size -= getStackSizeChange(n); if (size == 0) {
assert size >= 1; for (AbstractInsnNode n = m.getPrevious(); n != null; n = n.getPrevious()) { size -= getStackSizeChange(n); if (size == 0) {
assert size >= 1; for (AbstractInsnNode n = m.getPrevious(); n != null; n = n.getPrevious()) { size -= getStackSizeChange(n); if (size == 0) {
if (!(methodNode.getPrevious().getOpcode() == Opcodes.ICONST_1 || methodNode.getPrevious().getOpcode() == Opcodes.ICONST_0)) {