Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Matching a Class That Contains an Annotation

Hey,

> I'll take your word for the moment that what I want to express is currently not possible. This is what I was doing a number of years ago to deal with the limitation:
>    declare error:
>        (call(@Testable * Foo.*(..))
>        || get(@Testable * Foo.*)
>        || set(@Testable * Foo.*)
>        || call(@Testable Foo.new(..)))
>        && !within(Foo+):
>        "called from elsewhere!";
>
> Where I needed to declare this separately for every class I wanted to protect. It seems the AspectJ syntax has changed on me since then, so the above probably doesn't work anymore without modification.

This should still work.  Of course the problem with that approach is
that you need to specify the same type in multiple different pointcut
pieces, and you will write lots of similar declares (one per type).
When the if() syntax is supported you would write just the one.

Andy


Back to the top