Bug 261729

Summary: Allow @DeclareParents type mixins without annotations
Product: [Tools] AspectJ Reporter: Dave Whittaker <dave>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Dave Whittaker CLA 2009-01-20 17:29:00 EST
It would be nice to have the ability to use delegation style mixins, like the @DeclareParents annotation now offers, when using code style aspects.  This would allow users who already have existing objects to leave the default implementation of their interfaces in regular java class files while still receiving the same benefit that ITDs offers.  It could be accomplished with a new declare statement which would reference a pointcut identifying which classes are affected, the interface that the inherited methods provide implementation for, and the class containing the default implementation of those methods.  On the mailing list I had suggested:

declare parents: ITDInterface+ implements ITDInterface defaultImpl ITDInterfaceImpl

Which should read as any class that implements ITDInterface or a subtype should inherit any method contained within ITDInterfaceImpl that is defined within ITDInterface.  There is probably a more readable way to accomplish this type of definition though.

As Andy Clement pointed out, something like "declare mixin" would probably be a more descriptive statement, and changing the @DeclareParents annotation to @DeclareMixin as well would likely avoid confusion for users fimiliar with the code style "declare parents" statement already.