From 5b8d2d6c7ab0102e8a1bb0384cf769ed8f0f34da Mon Sep 17 00:00:00 2001 From: chiba Date: Tue, 10 Jan 2006 18:35:51 +0000 Subject: [PATCH] fixed a bug on renameClass(). git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@232 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- src/main/javassist/bytecode/ConstPool.java | 20 ++++++++++++++------ 1 file 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 { -- 2.39.5