/** Add a class entry to the pool. */
  public int addClassReference(String fullyQualifiedName) {
    if (ClassHolder.isExternalClassName(fullyQualifiedName)) {
      fullyQualifiedName = ClassHolder.convertToInternalClassName(fullyQualifiedName);
      // System.out.println("addClassReference " + fullyQualifiedName);
    }

    int name_index = addUtf8Entry(fullyQualifiedName).getIndex();

    return addIndexReference(VMDescriptor.CONSTANT_Class, name_index, 0);
  }
  /** A helper to build a type description based on a built-in type and an array arity. */
  private static String makeDesc(char builtin, int arity) {
    if (arity == 0)
      switch (builtin) {
        case VMDescriptor.C_BYTE:
          return VMDescriptor.BYTE;
        case VMDescriptor.C_CHAR:
          return VMDescriptor.CHAR;
        case VMDescriptor.C_DOUBLE:
          return VMDescriptor.DOUBLE;
        case VMDescriptor.C_FLOAT:
          return VMDescriptor.FLOAT;
        case VMDescriptor.C_INT:
          return VMDescriptor.INT;
        case VMDescriptor.C_LONG:
          return VMDescriptor.LONG;
        case VMDescriptor.C_SHORT:
          return VMDescriptor.SHORT;
        case VMDescriptor.C_BOOLEAN:
          return VMDescriptor.BOOLEAN;
        case VMDescriptor.C_VOID:
          return VMDescriptor.VOID;
        default:
          if (SanityManager.DEBUG) SanityManager.THROWASSERT("No type match");
          return null;
      }
    else {
      StringBuilder desc = new StringBuilder(arity + 3);

      for (int i = 0; i < arity; i++) desc.append(VMDescriptor.C_ARRAY);

      desc.append(ClassHolder.makeDesc(builtin, 0));

      return desc.toString();
    }
  }
  /** Find a class descriptor (section 4.4.1) and return its index, returns -1 if not found. */
  public int findClass(String fullyQualifiedName) {
    String internalName = ClassHolder.convertToInternalClassName(fullyQualifiedName);
    int utf_index = findUtf8(internalName);
    if (utf_index < 0) return -1;

    return findIndexIndex(VMDescriptor.CONSTANT_Class, utf_index, 0);
  }