[jboss-cvs] javassist/src/main/javassist/bytecode ...
Shigeru Chiba
chiba at is.titech.ac.jp
Tue Jul 18 13:51:04 EDT 2006
User: chiba
Date: 06/07/18 13:51:04
Modified: src/main/javassist/bytecode ClassFile.java
Log:
a correct fix of HIBERNATE-37 (ProxyFactory could not handle a bridge method). Please check other JBoss products using Javassist.
Revision Changes Path
1.26 +14 -4 javassist/src/main/javassist/bytecode/ClassFile.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ClassFile.java
===================================================================
RCS file: /cvsroot/jboss/javassist/src/main/javassist/bytecode/ClassFile.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- ClassFile.java 19 Jan 2006 07:21:52 -0000 1.25
+++ ClassFile.java 18 Jul 2006 17:51:04 -0000 1.26
@@ -525,7 +525,7 @@
* Appends a method to the class.
*/
public void addMethod(MethodInfo minfo) throws CannotCompileException {
- testExistingMethod(minfo.getName(), minfo.getDescriptor());
+ testExistingMethod(minfo);
methods.add(minfo);
}
@@ -533,18 +533,28 @@
methods.add(minfo);
}
- private void testExistingMethod(String name, String descriptor)
- throws CannotCompileException {
+ private void testExistingMethod(MethodInfo newMinfo)
+ throws CannotCompileException
+ {
+ String name = newMinfo.getName();
+ String descriptor = newMinfo.getDescriptor();
ListIterator it = methods.listIterator(0);
while (it.hasNext()) {
MethodInfo minfo = (MethodInfo)it.next();
if (minfo.getName().equals(name)
+ && notBridgeMethod(minfo) && notBridgeMethod(newMinfo)
&& Descriptor.eqParamTypes(minfo.getDescriptor(),
descriptor))
throw new CannotCompileException("duplicate method: " + name);
}
}
+ /* For a bridge method, see Sec. 15.12.4.5 of JLS 3rd Ed.
+ */
+ private boolean notBridgeMethod(MethodInfo minfo) {
+ return (minfo.getAccessFlags() & AccessFlag.BRIDGE) == 0;
+ }
+
/**
* Returns all the attributes. The returned <code>List</code> object
* is shared with this object. If you add a new attribute to the list,
More information about the jboss-cvs-commits
mailing list