Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] RE: declare parents semantics clarification with annotations on interface mixin

Hello,

Well it seems through trial and error that when using @DeclareParents,
the classes will receive all annotations from the interface being
mixed-in. This is different from the AspectJ language semantics when
declaring an interface and superclass. Well, this makes sense to me now
because the semantics are inherently different. With @DeclareParents, we
are declaring a mixin and not a superclass. Maybe it should be renamed
to @DeclareMixin?

So, annotations from the mixed-in interface are included on the targets
because the mixin introduces the methods declared in the interface. It
appears that the code for execution of those methods is provided by
delegating the call to the defaultImpl class when those methods are not
already implemented by the target. Any annotations on the defaultImpl
appear to serve no purpose within this context.

This excerpt from the AspectJ 5 Developer's Notebook, "It's very
important to preserve the same semantics between the code style and the
annotation style," which is implying that the semantics are the same is
just misleading, because the semantics are indeed quite different.

Regards,
Larry


Back to the top