aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2006-01-10 18:35:51 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2006-01-10 18:35:51 +0000
commit5b8d2d6c7ab0102e8a1bb0384cf769ed8f0f34da (patch)
tree4c5f43751835bc98063fc5df1fcb30c9fb7d6b68 /src
parent44627e404b082f831e313dfe0101f7acac2da8a9 (diff)
downloadjavassist-5b8d2d6c7ab0102e8a1bb0384cf769ed8f0f34da.tar.gz
javassist-5b8d2d6c7ab0102e8a1bb0384cf769ed8f0f34da.zip
fixed a bug on renameClass().
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@232 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src')
-rw-r--r--src/main/javassist/bytecode/ConstPool.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/main/javassist/bytecode/ConstPool.java b/src/main/javassist/bytecode/ConstPool.java
index 83159d21..6a1660ad 100644
--- a/src/main/javassist/bytecode/ConstPool.java
+++ b/src/main/javassist/bytecode/ConstPool.java
@@ -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 {