[jboss-cvs] javassist/src/main/javassist ...
Shigeru Chiba
chiba at is.titech.ac.jp
Tue Aug 29 04:39:32 EDT 2006
User: chiba
Date: 06/08/29 04:39:32
Modified: src/main/javassist CtBehavior.java ClassMap.java
Log:
minor bug fixes
Revision Changes Path
1.31 +6 -4 javassist/src/main/javassist/CtBehavior.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CtBehavior.java
===================================================================
RCS file: /cvsroot/jboss/javassist/src/main/javassist/CtBehavior.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- CtBehavior.java 18 Jul 2006 15:33:13 -0000 1.30
+++ CtBehavior.java 29 Aug 2006 08:39:32 -0000 1.31
@@ -47,18 +47,20 @@
if (map == null)
map = new ClassMap();
- map.put(srcClass.getName(), declaring.getName());
+ map.add(srcClass.getName(), declaring.getName());
try {
boolean patch = false;
CtClass srcSuper = srcClass.getSuperclass();
- String destSuperName = declaring.getSuperclass().getName();
- if (srcSuper != null) {
+ CtClass destSuper = declaring.getSuperclass();
+ String destSuperName = null;
+ if (srcSuper != null && destSuper != null) {
String srcSuperName = srcSuper.getName();
+ destSuperName = destSuper.getName();
if (!srcSuperName.equals(destSuperName))
if (srcSuperName.equals(CtClass.javaLangObject))
patch = true;
else
- map.put(srcSuperName, destSuperName);
+ map.add(srcSuperName, destSuperName);
}
methodInfo = new MethodInfo(cp, srcInfo.getName(), srcInfo, map);
1.7 +36 -0 javassist/src/main/javassist/ClassMap.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ClassMap.java
===================================================================
RCS file: /cvsroot/jboss/javassist/src/main/javassist/ClassMap.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- ClassMap.java 11 Jan 2006 06:45:54 -0000 1.6
+++ ClassMap.java 29 Aug 2006 08:39:32 -0000 1.7
@@ -61,12 +61,21 @@
/**
* Maps a class name to another name in this hashtable.
+ * If the hashtable contains another mapping from the same
+ * class name, the old mapping is replaced.
* This method translates the given class names into the
* internal form used in the JVM before putting it in
* the hashtable.
*
+ * <p>If <code>oldname</code> is equivalent to
+ * <code>newname</code>, then this method does not
+ * perform anything; it does not record the mapping from
+ * <code>oldname</code> to <code>newname</code>. See
+ * <code>fix</code> method.
+ *
* @param oldname the original class name
* @param newname the substituted class name.
+ * @see #fix(String)
*/
public void put(String oldname, String newname) {
if (oldname == newname)
@@ -78,6 +87,33 @@
super.put(oldname2, toJvmName(newname));
}
+ /**
+ * Maps a class name to another name unless another mapping
+ * has been already recorded.
+ * This method translates the given class names into the
+ * internal form used in the JVM before putting it in
+ * the hashtable.
+ *
+ * <p>If <code>oldname</code> is equivalent to
+ * <code>newname</code>, then this method does not
+ * perform anything; it does not record the mapping from
+ * <code>oldname</code> to <code>newname</code>. See
+ * <code>fix</code> method.
+ *
+ * @param oldname the original class name
+ * @param newname the substituted class name.
+ * @see #fix(String)
+ */
+ public void add(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);
}
More information about the jboss-cvs-commits
mailing list