Bug 252285

Summary: Generated methods for generic ITD field need BRIDGED access flag
Product: [Tools] AspectJ Reporter: Dave Whittaker <dave>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: aclement
Version: 1.6.3   
Target Milestone: 1.6.3   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Dave Whittaker CLA 2008-10-27 18:39:58 EDT
I have an ITD SelectActionAspect containing a generic member:

private T selected;

Javassist is extending the class at runtime as in bug 250493 and I get a DuplicateMemberException on:

ajc$interFieldGet$h2_actions_SelectActionAspec
t$h2_actions_SelectAction$selected in mhc.blog.BlogAction_$$_javassist_46

It seems like AspectJ is generating a bridge method corresponding to the generic member, but it's not setting the access flag.  If you need anything more from me to supply a resolution let me know.
Comment 1 Andrew Clement CLA 2008-10-27 19:18:56 EDT
Please can I have a bit more of the declaration that leads to the problem?
Comment 2 Andrew Clement CLA 2008-10-27 19:55:30 EDT
actually, think I have it:
import java.lang.reflect.Method;
import java.util.*;

interface Super<R extends Number> {
}

aspect X {
 private T Super<T>.getterA;
}

public class Bridged implements Super<Integer> {

        // Print BRIDGE status of all getter* methods
        public static void main(String[] argv) {
                Method[] ms = Bridged.class.getMethods();
                List results = new ArrayList(); 
                for (int i = 0; i < ms.length; i++) {
                        if (ms[i].getName().indexOf("getter")!=-1) {
                               
results.add(ms[i].getName()+"()"+ms[i].getReturnType().getName()+ " isBridged?"+((ms[i].getModifiers() & 0x0040) != 0));
                        }
                }
                Collections.sort(results);
                for (Iterator iterator = results.iterator();
iterator.hasNext();) {
                        String entry = (String) iterator.next();
                        System.out.println(entry);
                }
        }
}
--
prints:

ajc$interFieldGet$X$Super$getterA()java.lang.Integer isBridged?false
ajc$interFieldGet$X$Super$getterA()java.lang.Number isBridged?false
ajc$interFieldSet$X$Super$getterA()void isBridged?false
ajc$interFieldSet$X$Super$getterA()void isBridged?false

Comment 3 Andrew Clement CLA 2008-10-27 20:53:56 EDT
Fixed now.  Output now tells me that two of the methods are bridged.  Fix will be in an AJDT build shortly after 1.6.1 AJDT final is released (wednesday).

Really sorry I didn't get this fixed at the same time as methods !
Comment 4 Dave Whittaker CLA 2008-10-28 12:24:56 EDT
No problem.  Thanks once again for the fast response.