Summary: | no error with parameterized around return type on incompatible join point | ||
---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Wes Isberg <wes> |
Component: | Compiler | Assignee: | Andrew Clement <aclement> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P2 | ||
Version: | 1.5.0M4 | ||
Target Milestone: | 1.5.0RC1 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Wes Isberg
2005-11-06 21:17:47 EST
What a nightmare!! I've fixed it, but worth keeping a list of what I changed and why: we have members like 'getDeclaredMethods()' in ResolvedType - when these are called for a parameterized form of a generic type, the return value (the set of methods) are parameterized forms of the generic methods according to the type parameters used in the parameterized type. We also have a method 'getDeclaredAdvice()' which was partially transforming the advice it was returning but it didnt modify the signature of the advice from the generic type - in the case of this bug, this meant the return value of the advice 'Target' was collapsed to a bound rather than set to the type parameter for the subtype 'C'. I modified the parameterization logic to work for advice members too. Basically I changed the 'ShadowMunger.parameterizeWith()' method to take an extra parameter (the parameterized type) so that the signature for the munger could be modified. You then get the error reported as expected by Wes. However, I then wrote a test program that was allowed to be advised by this kind of parameterized advice. Unfortunately my parameterization changes meant that when we reached the weaving of the advice we were incorrectly using the parameterized signature in trying to work out what to call in the code we generate - so I had to modify the code generation to use the original generic signature and include the appropriate casts. This was easy because whenever we parameterize a member we stash the original member in the parameterized variant we construct - hence all the new references to 'hasBackingGenericMember()'. So, the changes: ResolvedMemberImpl.parameterizedWith() - had to fix it to copy the parameternames across when returning a parameterized member backed by a generic member. ShadowMunger.parameterizeWith() - added the parameterized type as a field to the method. ResolvedType.getDeclaredAdvice() - calls the new form of parameterizeWith() on the mungers. Checker - had to implement the new form of parameterizeWith() Advice.getDeclaringAspect() - changed to allow for parameterized advice inherited from generic aspects. BcelAdvice.parameterizeWith() - parameterizes the signature of the munger too. Utility.createInvoke() - no longer tries to create invokeStatic calls to parameterized types! BcelShadow - changed so that code gen copes with parameterized advice. and with all that - it works. fix checked in. fix available. |