<h2>Changes</h2>
+<p>-version 3.4
+<ul>
+ <li>A bug in CodeConverter#replaceFieldRead() and CodeConverter#replaceFieldWrite()
+ was fixed. <a href="http://jira.jboss.com/jira/browse/JBAOP-284">JBAOP-284</a>.
+</ul>
+
<p>-version 3.3 on August 17, 2006
<ul>
<li>CtClass#toClass() and ClassPool#toClass() were modified to accept a
try {
CtClass c = pool.get(cp.getFieldrefClassName(index));
- if (is_private ? c == fclass : c.subclassOf(fclass))
+ if (c == fclass || (!is_private && isFieldInSuper(c, fclass, fname)))
return cp.getFieldrefType(index);
}
catch (NotFoundException e) {}
return null;
}
+ static boolean isFieldInSuper(CtClass clazz, CtClass fclass, String fname) {
+ if (!clazz.subclassOf(fclass))
+ return false;
+
+ try {
+ CtField f = clazz.getField(fname);
+ return f.getDeclaringClass() == fclass;
+ }
+ catch (NotFoundException e) {}
+ return false;
+ }
+
public int transform(CtClass tclazz, int pos, CodeIterator iterator,
ConstPool cp) throws BadBytecode
{