[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Constructor execution advice is called twice

I suspect that it is capturing EACH constructor executed. If you have a flat hierarchy, this is your constructor plus Object(). If you deepened your hierarchy, you probably get more because it is logging Foo(), Bar(), Object() in the hiearchy Foo extends Bar extends Object.

Hope this helps

On Sep 21, 2007, at 11:19 AM, Arturo Zambrano wrote:

Hello List,

I'm trying to capture the execution of aspect constructors in a hierarchy.
The problem is that I'm getting the advice executed twice.

 The pointcut is something like

pointcut aspectConstructor(RO o):execution (RO+.new(..)) && target(o);

and the advice is

before (RO o): aspectConstructor(o) {

        logger.info("Captured creation of  " + o);


I expected the logger line to be executed just once for each aspect in the hierarchy (they all have just the default constructor implemented).
I have debugged it, and the advice code is called twice before the constructor execution.

If an "after " advice is used, it is called before and after constructor execution.

Similar results are obtained when "initialization" poincut is used insted "execution" one.

Is this behavior supposed to happen? Maybe a bug?
I could not find any information regarding this issue.

regards. arturo

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