[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Pointcut question



Andreas,

I suspect your are using the wrong _kind_ of pointcut. If you want to
advise the execution of the doStuff() methods you need the "execution()"
PCD:

      pointcut myPointcut() : execution(public void doStuff(..));

Any advice associated with your existing pointcut will only advise
invocations of those methods which in the example is only the single
"doStuff(null)" call in "doStuff()". Are you using Eclipse + AJDT. If so it
will be much clearer from the editor and other views what is going on.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/

Andreas Mueller <am@xxxxxx>@eclipse.org on 18/03/2005 08:47:16

Please respond to aspectj-dev@xxxxxxxxxxx

Sent by:    aspectj-dev-admin@xxxxxxxxxxx


To:    aspectj-dev@xxxxxxxxxxx
cc:
Subject:    [aspectj-dev] Pointcut question


Hi,

let's say I have the following methods in a class:

public void doStuff()
{
   doStuff(null);
}


public void doStuff(String s)
{
   // do stuff
}

Here is the point cut:

pointcut myPointcut() : call(public void doStuff(..));

I would expect that an advice would be inserted in both doStuff methods.
But it's only inserted into doStuff(), not in doStuff(String). I've
tried also to define the point cut as follows:

pointcut myPointcut() : call(public void doStuff()) ||
                                     call(public void doStuff(String));

With the same result.

Any hints how do I get the trick to get the advice inserted into both
methods?

Thanks,
Andreas

--

Andreas Mueller
IIT GmbH, Bremen/Germany
http://www.swiftmq.com


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