[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Annotation pointcut

Andrew Clement wrote:

That is aspectj working as designed. Constructor patterns really have no return
type and if you specify one you get an error. What would you be trying to
say with the first variant? That a constructor returns an @Alien annotated instance?
The second variant says execution of a constructor on an @Alien annotated type -
I guess thats what you want.

Correct, and now I understand also my misunderstanding with my first variant - I didn't realized that it is interpreted as return type. But when I tried

after(Object x) : execution((@Alien *) Passenger+.new(..)) && this(x)

it compiles (I want to hit all Passenger subclasses with an @Alien annotation). It is similar to the first example (that with the syntax error) but does not work as I expected. Now, if I understand you correct the (@Alien *) here is standing for the return type -- but then it shouldn't compile (a constructor has no return type, as you mentioned correctly)?!?



*"Oli B." <boehm@xxxxxxxxxx>*
Sent by: aspectj-dev-admin@xxxxxxxxxxx

08/03/2005 21:46
Please respond to

To aspectj-dev@xxxxxxxxxxx cc Subject [aspectj-dev] Annotation pointcut


i want to hit all constructors of classes with an @Alien annotation:

after(Object x) : execution((@Alien *) *.new(..)) && this(x) {

The result of this pointcut is a 'Syntax error on token "(",
"constructor patterns have no return type" expected'. When I modify it a
little bit to

                after(Object x) : execution((@Alien *).new(..)) && this(x) {

it works as expected. The only difference is the missing 2nd "*" in
((@Alien *) *.new(..)) from the first try. Is it a bug (build
20050225125806) or a misunderstanding from me?

Oliver Böhm

aspectj-dev mailing list

Oliver Böhm