コード例 #1
1
  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();
  }
コード例 #2
0
  /**
   * 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;
  }