[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] why the !within! in the aspect

According to an answer that I had in this forum:
 

For #2, your before advice in Lolo was executing on staticinitialization of the Lolo aspect, which failed because the aspect wasn?t yet initialized. You already figured out the way to avoid the problem J

 

I was expecting that the following aspect will work but it still gives the error NoAspectBoundException: Lolo
 
Why???? Why I must put the !within(Lolo)
 
 
aspect Lolo
 
{
 

pointcut p2(): !staticinitialization(*)&& ! initialization (*.new(..))&&!preinitialization(*.new(..));
 
before(): p2() {
 
System.out.println(">>Before the join point:"+thisJoinPoint);
 
}
 
 
    class Nadia1 {

public static Bank b,c;

public static void main(String[] args) {

b=new Bank();

c=new Bank();}}

class Bank {}

/****************************************************/

#2 The aspect was originally

aspect Lolo

{

pointcut p2():if (true);

before(): p2() {

System.out.println(">>Before the join point:"+thisJoinPoint);

}

}

Thank you

Nadia.