Browse Source

fixed a bug on renameClass().


git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@232 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
tags/rel_3_17_1_ga
chiba 18 years ago
parent
commit
5b8d2d6c7a
1 changed files with 14 additions and 6 deletions
  1. 14
    6
      src/main/javassist/bytecode/ConstPool.java

+ 14
- 6
src/main/javassist/bytecode/ConstPool.java View File

@@ -868,14 +868,18 @@ public final class ConstPool {
/**
* Replaces all occurrences of a class name.
*
* @param oldName the replaced name
* @param newName the substituted name.
* @param oldName the replaced name (JVM-internal representation).
* @param newName the substituted name (JVM-internal representation).
*/
public void renameClass(String oldName, String newName) {
LongVector v = items;
int size = numOfItems;
for (int i = 1; i < size; ++i)
((ConstInfo)v.elementAt(i)).renameClass(this, oldName, newName);
classes = new HashMap(classes.size() * 2);
for (int i = 1; i < size; ++i) {
ConstInfo ci = (ConstInfo)v.elementAt(i);
ci.renameClass(this, oldName, newName);
ci.makeHashtable(this);
}
}

/**
@@ -887,8 +891,12 @@ public final class ConstPool {
public void renameClass(Map classnames) {
LongVector v = items;
int size = numOfItems;
for (int i = 1; i < size; ++i)
((ConstInfo)v.elementAt(i)).renameClass(this, classnames);
classes = new HashMap(classes.size() * 2);
for (int i = 1; i < size; ++i) {
ConstInfo ci = (ConstInfo)v.elementAt(i);
ci.renameClass(this, classnames);
ci.makeHashtable(this);
}
}

private void read(DataInputStream in) throws IOException {

Loading…
Cancel
Save