/** * We try to detect such a last 2 instructions and extract the enum signature. * * @code{ INVOKESTATIC * FindTouchPointsMethodAdapter.$SWITCH_TABLE$net$sourceforge$cobertura$instrument$FindTouchPointsMethodAdapter$Abc() * : int[] ALOAD 1: a INVOKEVIRTUAL FindTouchPointsMethodAdapter$Abc.ordinal() : int IALOAD } */ private String tryToFindSignatureOfConditionEnum() { // mv.visitMethodInsn(INVOKESTATIC, // "net/sourceforge/cobertura/instrument/FindTouchPointsMethodAdapter", // "$SWITCH_TABLE$net$sourceforge$cobertura$instrument$FindTouchPointsMethodAdapter$Abc", // "()[I"); // mv.visitVarInsn(ALOAD, 1); // mv.visitMethodInsn(INVOKEVIRTUAL, // "net/sourceforge/cobertura/instrument/FindTouchPointsMethodAdapter$Abc", "ordinal", "()I"); // mv.visitInsn(IALOAD); if (backlog == null || backlog.size() < 4) return null; int last = backlog.size() - 1; if ((backlog.get(last) instanceof InsnNode) && (backlog.get(last - 1) instanceof MethodInsnNode) && (backlog.get(last - 2) instanceof VarInsnNode)) { VarInsnNode i2 = (VarInsnNode) backlog.get(last - 2); MethodInsnNode i3 = (MethodInsnNode) backlog.get(last - 1); InsnNode i4 = (InsnNode) backlog.get(last); if ((i2.getOpcode() == Opcodes.ALOAD) && (i3.getOpcode() == Opcodes.INVOKEVIRTUAL && i3.name.equals("ordinal")) && (i4.getOpcode() == Opcodes.IALOAD)) { return i3.owner; } } return null; }
protected String printInsnNode(InsnNode in, ListIterator<?> it) { return nameOpcode(in.opcode()); }