Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Matching based on extension type

I think it is probably unlikely that we'll have it.  I'd imagine you could define a rule in something like FindBugs to do that kind of test.

Andy

2009/8/14 Paulo Zenida <paulo.zenida@xxxxxxxx>
Hi Andy.

That's what I thought, then. It is not possible statically! :-(

Dynamically, I knew we could do it.

Thanks for your quick reply, as usual :-)

Do you think this behaviour will be added in a future version of AspectJ?

Regards,

Paulo Zenida



Citando Andy Clement <andrew.clement@xxxxxxxxx>:


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 <paulo.zenida@xxxxxxxx>

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
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users






_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top