Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] adviceexecution without cflow

Hello!

Please, look at the simple code below:

public aspect TestAdviceExecution {

      pointcut methods(): execution(public * *(..));
      pointcut logger(): execution(void Log.log(String));

      before(): methods() && !logger() {
              Log.logging("Logging...");
      }

}

As you can see, I have used the logger pointcut in order to avoid the
problem of infinite loops.

Ok. Now, I am studying the adviceexecution pointcut. The code that I
used to get the same result of the code above is:

public aspect TestAdviceExecution {

	 pointcut methods(): execution(public * *(..));

	 before(): methods() && !cflow(adviceexecution()) {
		 Log.logging("Logging...");
	 }

}

My question is: why the code below does not work if the
adviceexecution is supposed to get join points inside advices? In
other words: this code advises the logging method, causing the
infinite loop... :(

public aspect TestAdviceExecution {

	 pointcut methods(): execution(public * *(..));

	 before(): methods() && !adviceexecution() {
		 Log.logging("Logging...");
	 }

}

I do not know if I am right, but why do I have to use the cflow in this example?

Thank you so much!

Márcio.
--
Márcio de Medeiros Ribeiro
MSc Candidate
Informatics Center (CIn)
Federal University of Pernambuco (UFPE)
http://www.cin.ufpe.br/~mmr3/
Member of the Software Productivity Group (SPG)
http://www.cin.ufpe.br/spg/
Contact: +55 81 2126-8430 - Extension: 4793


Back to the top