not statically, but dynamically:
before(): staticinitialization(*Base) {
if
(thisJoinPointStaticPart.getSignature().getDeclaringType().getSuperclass().getName().endsWith("Base"))
{
throw new
IllegalStateException(thisJoinPointStaticPart.getSignature().getDeclaringType().getName()+"
extends
"+thisJoinPointStaticPart.getSignature().getDeclaringType().getSuperclass().getName());
}
}
Andy
2009/8/14 Paulo Zenida <[email protected]>
> Hello all.
>
> Is it possible to do AspectJ matching based on the extension clause defined
> in a given type? For instance, can I define a policy in which it is not
> possible for a class whose name ends with Base extend another class whose
> name also ends with Base?
>
> Something like (simplified syntax):
>
> declare warning : *Base extends *Base : "You should not extend a Base class
> from another Base class";
>
> I looked for it in the Web and tried several approaches but no good
> results, unfortunately... :-(
>
> Thank you for your attention.
>
> Kind regards,
>
> Paulo Zenida
>
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users