[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)?!?

regards
Oliver


Andy.



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

08/03/2005 21:46
Please respond to
aspectj-dev@xxxxxxxxxxx


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







Hello,

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?

regards
Oliver
--
Oliver Böhm
http://www.javatux.de

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev



--
Oliver Böhm
http://www.javatux.de