Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] LTW, javaagent, JUnit and ANT integration

@target(..) allows to bind the annotation instance to some variable
that can be passed in as an argument to the advice.
target(..) allows the same but not for the annotation, just for the
target instance
If you don't use them to bind variables, there is indeed some overlap
as you describe.

In your code sample the annotation is on the interface, not on the
actual declaring type of the called method. Try to move / copy the
annotation (and remember method level annotation cannot be inherited
as described by Java 5).

Alex

On 8/11/05, Valerio Schiavoni <ervalerio@xxxxxxxxxx> wrote:
> Hello Alex
> 
> thanks for your explanations.
> 
> Following this link:
> http://eclipse.org/aspectj/doc/next/adk15notebook/annotations-pointcuts-and-advice.html#d0e1194
> 
> i understood that the @target is the pcd designator i need.
> 
> The example pointcut in the doc:
> call(* *(..)) && @target(Classified)
> 
> seems to be what i need, with these modifications:
> call(* AnnotatedService+.*(..)) && @target(MemberOfMonitoredSet);
> 
> If so it is,  still my advice is not being executed.
> AJDT tooltip reports that this advice advises the method-call void
> test.AnnotatedService.print(String) (runtime test)
> 
> One more doubt i have is what is the difference between the above
> pointcut and the following one:
> call(* AnnotatedService+.*(..)) && target(@MemberOfMonitoredSet *);
> 
> I suppose the first one can perform a checking at runtime, while the
> second can only check against static types of target objects.
> 
> Sincerly, i don't understand what is going on here..
> This is the output i get when launching my test:
> http://veleno.pastebin.com/334503
> 
> As you can see, the string that should be printed by this advice:
> http://veleno.pastebin.com/334504
> 
> is not printed.
> 
> Any idea ?
> 
> 
> 
> Alexandre Vasseur ha scritto:
> 
> >call(* Service+.print(..)) && @annotation(MemberOfMonitoredSet);
> >
> >
> >In your case the annotation is a class level one on the interface
> >implemented by the declaring type.
> >
> >
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top