Bug 261729 - Allow @DeclareParents type mixins without annotations
Summary: Allow @DeclareParents type mixins without annotations
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-20 17:29 EST by Dave Whittaker CLA
Modified: 2009-01-20 17:29 EST (History)
0 users

See Also:


Attachments

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