Question regarding AspectJ wildcards

M

Matthias Kaeppler

Hi guys,

concerning AspectJ, I was wondering about difference between the * and
... wildcards. In an exercise for a software engineering class, we had
that example where an aspect had to be provided, which would trace every
method execution in a certain program (disregarding anything
defined/called in the aspect itself).

The tutor came up with this:

(1) pointcut callAnyMethod(): execution(* *..*(..));

with a side note: "This will probably do, too:"

(2) pointcut callAnyMethod(): call(* *(..)) && !within(EnclosingAspect);

My questions are:
1. In (1) we see the two different wildcards. While I have observed that
... is used for parameters in particular, where are the exact differences
between * and ..? Especially, since the first * matches any access
modifier, and the second * any return type, I suppose that .. would
match any (possibly) fully qualified method name, but then, what does
the third * match??

2. In (2) the .. wildcard is not used to express the "any method"
pointcut. How come? Actually, this version of matching "any method" is
also what I found throughout the tutorial on the AspectJ website.
Besides, why do we have to define !within(EnclosingAspect) (just suppose
the enclosing aspect was actually named EnclosingAspect) here, but not
in (1)? Surely the advices in EnclosingAspect are executed at some point
as well, so shouldn't this also be added to (1)?

Bottom line, either I'm missing up on something, or our tutor is :)
I hope you can tell me, as I have an exam on Thursday.

Best regards,
Matthias Kaeppler
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top