Пример #1
0
  /** Print constant pool entry information. */
  public int PrintlnConstantEntry(int cpx) {
    int size = 1;
    byte tag = 0;
    try {
      tag = cls.getTag(cpx);
    } catch (IndexOutOfBoundsException e) {
      out.println("  <Incorrect CP index>");
      return 1;
    }
    out.print(cls.StringTag(cpx) + "\t");
    Object x = cls.getCpoolEntryobj(cpx);
    if (x == null) {
      switch (tag) {
        case RuntimeConstants.CONSTANT_LONG:
        case RuntimeConstants.CONSTANT_DOUBLE:
          size = 2;
      }
      out.println("null;");
      return size;
    }
    String str = cls.StringValue(cpx);

    switch (tag) {
      case RuntimeConstants.CONSTANT_CLASS:
      case RuntimeConstants.CONSTANT_STRING:
        out.println("#" + (((CPX) x).cpx) + ";\t//  " + str);
        break;
      case RuntimeConstants.CONSTANT_FIELD:
      case RuntimeConstants.CONSTANT_METHOD:
      case RuntimeConstants.CONSTANT_INTERFACEMETHOD:
        out.println("#" + ((CPX2) x).cpx1 + ".#" + ((CPX2) x).cpx2 + ";\t//  " + str);
        break;
      case RuntimeConstants.CONSTANT_NAMEANDTYPE:
        out.println("#" + ((CPX2) x).cpx1 + ":#" + ((CPX2) x).cpx2 + ";//  " + str);
        break;
      case RuntimeConstants.CONSTANT_LONG:
      case RuntimeConstants.CONSTANT_DOUBLE:
        size = 2;
      default:
        out.println(str + ";");
    }
    return size;
  }