Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Package Annotations

In the section headed "Package and Parameter Annotations" :

http://www.eclipse.org/aspectj/doc/next/adk15notebook/annotations-pointcuts-and-advice.html#d0e1421

the notebook also says:

"Note: A previous design allowed package annotation patterns to be
specified directly in type patterns, and parameter annotation patterns
to be specified directly in method and constructor signature patterns.
Because this made some pointcut expressions hard to read and
understand, we moved in favour of the design presented below (should
say above), which also has its drawbacks (namely, you can't match on
package and parameter annotations). Matching on package and parameter
annotations will be deferred until after the 1.5.0 release so that we
can gain more understanding of the kinds of uses AspectJ users are
making of annotations in pointcut expressions before commiting to any
one approach."

(I added the stuff in parentheses).

-- Adrian.

On 26/08/05, Vincent Jorrand <vjorrand@xxxxxxxxx> wrote:
> The  AspectJ 5 Developer's Notebook says:
> 
> 
> 
> >          For any kind of annotated element (type,
> method, constructor, package, etc.), an annotation
> pattern can be used to match against the set of
> annotations on the annotated element.
> 
> 
> 
> But I cannot find any way to use package annotations
> in aspects.
> 
> What I would like to do is add an annotation to some
> packages and then write a pointcut that matches all
> methods in classes in packages that declare the
> annotations.
> 
> It would probably look something like:
> 
> 
> 
> public aspect MyAspect {
> 
>     pointcut pc(): execution(* (@MyAnnotation
> *).*.*());
> 
> 
> 
>     before(): pc() {
> 
>         System.out.println("here");
> 
>     }
> 
> }
> 
> 
> 
> But the above is not allowed by the syntax for
> TypePattern.
> 
> The TypePattern syntax only allows annotations at the
> outermost level as far as I can tell.
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 


-- 
-- Adrian
adrian.colyer@xxxxxxxxx


Back to the top