Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Exposing annotations in Parameters

Hi Carlos,

See (unfortunately not yet implemented) enhancement request
https://bugs.eclipse.org/bugs/show_bug.cgi?id=259416 that I raised a
while back.  You can see it talks about extending the syntax for @args
to allow for parameter annotations, similar to how the syntax is
extended in the method signatures to either mean the a type annotation
or a parameter annotation.  It has no votes so I haven't even looked
to do it yet...  your example would be:

 pointcut myPointcut(Bar b) : execution( * *.foo(@Bar (int),..)) &&
@args(b (*),..);

Add a comment and a vote and who knows :)

Through the thisJoinPoint object you should be able to dig for them,
but it wouldn't be pleasant code.

cheers,
Andy

On 24 March 2010 11:11, Carlos Noguera <cnoguera@xxxxxxxxxxxxxx> wrote:
> Hi everybody,
>
> I have been looking at the doc for AspectJ5 (and what I was able to find for
> AspectJ6) and I haven't found a way to solve my problem.
>
> So, my problem: I want to be able to capture annotations present in the
> arguments of a method  on my pointcut.
>
> So, for a method that looks like:
>
> public void foo( @Bar("something") int b){}
>
> I would like to be able to write a pointcut that looks like:
>
> pointcut myPointcut(Bar b) : execution( * *.foo(@Bar (int),..)) &&
> @args(b,..);
>
> Now, this does not work because @args() expects the *type* of the argument
> to carry the annotation, not the argument itself.
>
> So, is there a way to capture b in my example?
>
> .:: Carlos
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top