diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2009-07-02 11:17:17 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2009-07-02 11:17:17 +0000 |
commit | d8ba90667b8d2ca3ce409d355373aecaf48ae871 (patch) | |
tree | 65e7cb15554db75f0751f1c89ae096aa9e037661 /src/main/javassist/bytecode/AttributeInfo.java | |
parent | a690c8bf872c9e5fe4e14b6095ddb81de01a34c4 (diff) | |
download | javassist-d8ba90667b8d2ca3ce409d355373aecaf48ae871.tar.gz javassist-d8ba90667b8d2ca3ce409d355373aecaf48ae871.zip |
fixed JIRA JASSIST-77
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@485 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/bytecode/AttributeInfo.java')
-rw-r--r-- | src/main/javassist/bytecode/AttributeInfo.java | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/main/javassist/bytecode/AttributeInfo.java b/src/main/javassist/bytecode/AttributeInfo.java index 67d1c48e..915f291f 100644 --- a/src/main/javassist/bytecode/AttributeInfo.java +++ b/src/main/javassist/bytecode/AttributeInfo.java @@ -21,6 +21,8 @@ import java.io.IOException; import java.util.Map; import java.util.LinkedList; import java.util.ListIterator; +import java.util.List; +import java.util.Iterator; // Note: if you define a new subclass of AttributeInfo, then // update AttributeInfo.read(), .copy(), and (maybe) write(). @@ -92,9 +94,10 @@ public class AttributeInfo { */ if (nameStr.equals(LineNumberAttribute.tag)) return new LineNumberAttribute(cp, name, in); - else if (nameStr.equals(LocalVariableAttribute.tag) - || nameStr.equals(LocalVariableAttribute.typeTag)) + else if (nameStr.equals(LocalVariableAttribute.tag)) return new LocalVariableAttribute(cp, name, in); + else if (nameStr.equals(LocalVariableTypeAttribute.tag)) + return new LocalVariableTypeAttribute(cp, name, in); else if (nameStr.equals(AnnotationsAttribute.visibleTag) || nameStr.equals(AnnotationsAttribute.invisibleTag)) { // RuntimeVisibleAnnotations or RuntimeInvisibleAnnotations @@ -243,4 +246,28 @@ public class AttributeInfo { return newList; } + + /* The following two methods are used to implement + * ClassFile.renameClass(). + * Only CodeAttribute and LocalVariableAttribute override + * this method. + */ + void renameClass(String oldname, String newname) {} + void renameClass(Map classnames) {} + + static void renameClass(List attributes, String oldname, String newname) { + Iterator iterator = attributes.iterator(); + while (iterator.hasNext()) { + AttributeInfo ai = (AttributeInfo)iterator.next(); + ai.renameClass(oldname, newname); + } + } + + static void renameClass(List attributes, Map classnames) { + Iterator iterator = attributes.iterator(); + while (iterator.hasNext()) { + AttributeInfo ai = (AttributeInfo)iterator.next(); + ai.renameClass(classnames); + } + } } |