<p>-version 3.3
<ul>
+ <li>CtClass#getAvailableAnnotations() etc. have been implemented.
+ <li>A bug related to a way of dealing with a bridge method was fixed
+ (<a href="http://jira.jboss.com/jira/browse/HIBERNATE-37">HIBERNATE-37</a>).
<li>javassist.scopedpool package was added.
</ul>
<ul>
<li>A bug of replace(String,ExprEditor) in javassist.expr.Expr has been fixed.
<li>Updated ProxyFactory getClassLoader to choose the javassit class loader
- when the proxy superclass has a null class loader (a jdk/endorsed class).
- <a href='http://jira.jboss.com/jira/browse/JASSIST-18'>JASSIST-18</a>
+ when the proxy superclass has a null class loader (a jdk/endorsed class)
+ (<a href='http://jira.jboss.com/jira/browse/JASSIST-18'>JASSIST-18</a>).
<li>Updated the throws clause of the javassist.util.proxy.MethodHandler
- to be Throwable rather than Exception.
- <a href='http://jira.jboss.com/jira/browse/JASSIST-16'>JASSIST-16</a>
+ to be Throwable rather than Exception
+ (<a href='http://jira.jboss.com/jira/browse/JASSIST-16'>JASSIST-16</a>).
</ul>
<p>- version 3.2.0.CR1 on March 18, 2006
* Appends a method to the class.
*/
public void addMethod(MethodInfo minfo) throws CannotCompileException {
- testExistingMethod(minfo.getName(), minfo.getDescriptor());
+ testExistingMethod(minfo);
methods.add(minfo);
}
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))
+ 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,
else {
MethodInfo delegator
= makeDelegator(meth, desc, cp, declClass, delegatorName);
+ // delegator is not a bridge method. See Sec. 15.12.4.5 of JLS 3rd Ed.
+ delegator.setAccessFlags(delegator.getAccessFlags() & ~AccessFlag.BRIDGE);
cf.addMethod(delegator);
}
* @param mod the modifiers of the method.
*/
private static boolean isVisible(int mod, String from, Member meth) {
- if ((mod & Modifier.VOLATILE) != 0)
- return false;
if ((mod & Modifier.PRIVATE) != 0)
return false;
else if ((mod & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0)