private void renameString(Hashtable classNameMap, CONSTANT_Index_info cii) {

    int index = cii.getI1();

    String name = nameIndexToString(index);
    String newName = (String) classNameMap.get(name);
    if (newName != null) {

      doRenameString(index, newName);

      return;
    }

    // have to look for arrays
    if (cii.getTag() == VMDescriptor.CONSTANT_Class) {

      if (name.charAt(0) == '[') {
        int classOffset = name.indexOf('L') + 1;

        String baseClassName = name.substring(classOffset, name.length() - 1);

        newName = (String) classNameMap.get(baseClassName);

        if (newName != null) {

          String newArrayClassName = name.substring(0, classOffset) + newName + ";";

          doRenameString(index, newArrayClassName);
        }
      }
    }
  }
  public Enumeration getStrings() {
    HashSet strings = new HashSet(30, 0.8f);

    int size = cptEntries.size();
    for (int i = 1; i < size; i++) {
      ConstantPoolEntry cpe = getEntry(i);

      if ((cpe == null) || (cpe.getTag() != VMDescriptor.CONSTANT_String)) continue;

      CONSTANT_Index_info cii = (CONSTANT_Index_info) cpe;

      strings.add(nameIndexToString(cii.getI1()));
    }

    return java.util.Collections.enumeration(strings);
  }
Exemplo n.º 3
0
  /** Return the class name for an index to a CONSTANT_Class_info. */
  protected String className(int classIndex) {
    CONSTANT_Index_info ci = (CONSTANT_Index_info) getEntry(classIndex);

    return nameIndexToString(ci.getI1()).replace('/', '.');
  }