Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] within

I must be misunderstanding what how to use this operator.

 

I have the following test code…

 

pointcut wibble() : execution (public void Session.set*(String));

 

pointcut subTest(OpsBaseAttribute attr) : execution(public void setValue(String))

                                                        && this(attr)

                                                        && cflow(execution (public void Session.set*(String)))

                                                        && !within(aspects.DateSub);

 

 

void around (OpsBaseAttribute attr) : subTest(attr)  {

    System.out.println("supposedly calling set on an attribute in the Session object for name ..." + attr.getName() + "...");

    if (attr.getName().equals("LastLogin") ||

        attr.getName().equals("Created") ||

        attr.getName().equals("LastModified")) {

        System.out.println("resetting for " + attr.getName());

        attr.setValue("2/02/2004 2:22:22 PM");

    }

  }

 

as you can see I’m making a call in my around advice that will re-trigger the pointcut.  Hence my stating “!within(DateSub)”, where DateSub is the name of the Aspect that all this code exists within.

 

My question is simple:  Why do I get infinte recursion when ‘within’ should mask out calls to setValue() from within the pointcut

 

Thanks for your help.

 

alan

 

 


Back to the top