Пример #1
0
  /** Print constant value at that index. */
  void PrintConstant(int cpx) {
    if (cpx == 0) {
      out.print("#0");
      return;
    }
    byte tag = 0;
    try {
      tag = cls.getTag(cpx);

    } catch (IndexOutOfBoundsException e) {
      out.print("#" + cpx);
      return;
    }
    switch (tag) {
      case RuntimeConstants.CONSTANT_METHOD:
      case RuntimeConstants.CONSTANT_INTERFACEMETHOD:
      case RuntimeConstants.CONSTANT_FIELD:
        {
          // CPX2 x=(CPX2)(cpool[cpx]);
          CPX2 x = (CPX2) (cls.getCpoolEntry(cpx));
          if (x.cpx1 == cls.getthis_cpx()) {
            // don't print class part for local references
            cpx = x.cpx2;
          }
        }
    }
    out.print(cls.TagString(tag) + " " + cls.StringValue(cpx));
  }
Пример #2
0
  /** Print ConstantValue attribute information. */
  public void printConstantValue(FieldData field) {
    out.print("  Constant value: ");
    int cpx = (field.getConstantValueIndex());
    byte tag = 0;
    try {
      tag = cls.getTag(cpx);

    } catch (IndexOutOfBoundsException e) {
      out.print("Error:");
      return;
    }
    switch (tag) {
      case RuntimeConstants.CONSTANT_METHOD:
      case RuntimeConstants.CONSTANT_INTERFACEMETHOD:
      case RuntimeConstants.CONSTANT_FIELD:
        {
          CPX2 x = (CPX2) (cls.getCpoolEntry(cpx));
          if (x.cpx1 == cls.getthis_cpx()) {
            // don't print class part for local references
            cpx = x.cpx2;
          }
        }
    }
    out.print(cls.TagString(tag) + " " + cls.StringValue(cpx));
  }