Browse Source

changed CtMethod#copy() and updated related javadoc comments


git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@396 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
tags/rel_3_17_1_ga
chiba 17 years ago
parent
commit
82e918f2e4

+ 20
- 1
src/main/javassist/ClassMap.java View File

@@ -82,7 +82,7 @@ public class ClassMap extends java.util.HashMap {
* <code>oldname</code> to <code>newname</code>. See
* <code>fix</code> method.
*
* @param oldname the original class name
* @param oldname the original class name.
* @param newname the substituted class name.
* @see #fix(String)
*/
@@ -96,6 +96,25 @@ public class ClassMap extends java.util.HashMap {
super.put(oldname2, toJvmName(newname));
}

/**
* Is equivalent to <code>put()</code> except that
* the given mapping is not recorded into the hashtable
* if another mapping from <code>oldname</code> is
* already included.
*
* @param oldname the original class name.
* @param newname the substituted class name.
*/
public void putIfNone(String oldname, String newname) {
if (oldname == newname)
return;

String oldname2 = toJvmName(oldname);
String s = (String)get(oldname2);
if (s == null)
super.put(oldname2, toJvmName(newname));
}

protected final void put0(Object oldname, Object newname) {
super.put(oldname, newname);
}

+ 1
- 1
src/main/javassist/CtBehavior.java View File

@@ -59,7 +59,7 @@ public abstract class CtBehavior extends CtMember {
if (srcSuperName.equals(CtClass.javaLangObject))
patch = true;
else
map.put(srcSuperName, destSuperName);
map.putIfNone(srcSuperName, destSuperName);
}

// a stack map table is copied from srcInfo.

+ 2
- 1
src/main/javassist/CtConstructor.java View File

@@ -74,7 +74,8 @@ public final class CtConstructor extends CtBehavior {
* with the name of the class and the superclass that
* the created constructor is added to.
* This is done whichever <code>map</code> is null or not.
* To prevent this replacement, call <code>ClassMap.fix()</code>.
* To prevent this replacement, call <code>ClassMap.fix()</code>
* or <code>put()</code> to explicitly specify replacement.
*
* <p><b>Note:</b> if the <code>.class</code> notation (for example,
* <code>String.class</code>) is included in an expression, the

+ 2
- 1
src/main/javassist/CtMethod.java View File

@@ -83,7 +83,8 @@ public final class CtMethod extends CtBehavior {
* with the name of the class and the superclass that the
* created method is added to.
* This is done whichever <code>map</code> is null or not.
* To prevent this replacement, call <code>ClassMap.fix()</code>.
* To prevent this replacement, call <code>ClassMap.fix()</code>
* or <code>put()</code> to explicitly specify replacement.
*
* <p><b>Note:</b> if the <code>.class</code> notation (for example,
* <code>String.class</code>) is included in an expression, the

Loading…
Cancel
Save