Bug 252285 - Generated methods for generic ITD field need BRIDGED access flag
Summary: Generated methods for generic ITD field need BRIDGED access flag
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.6.3   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P2 normal (vote)
Target Milestone: 1.6.3   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-27 18:39 EDT by Dave Whittaker CLA
Modified: 2008-10-28 12:24 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.