Please could you help me, in the two following questions (
Code is at the end)
1) Difference between staticinitialization,
preinitialization,initialization join points?? They occur between the call to
the construcor and the execution of the constructor. I saw that
staticinitialization occurs only the first time??
BUt what is the difference in the semantics?
2) My objective was to capture all the join points !!
So in the beginning I put only:
pointcut p2():if (true)
Why I had the following error at the execution of the
main??
Exception in thread "main"
java.lang.ExceptionInInitializerError
at Nadia1.<clinit>(Nadia1.java) Caused by:
org.aspectj.lang.NoAspectBoundException:
Lolo at
Lolo.aspectOf(True.java) at
Lolo.<clinit>(True.java) ...
1 more
It works only if I add ! within(Lolo) in the
pcd ??
And gives me this execution:
>>Before the join
point:staticinitialization(Nadia1.<clinit>) >>Before the join
point:execution(void Nadia1.main(String[])) >>Before the join
point:call(Bank()) >>Before the join
point:staticinitialization(Bank.<clinit>) >>Before the join
point:preinitialization(Bank()) >>Before the join
point:initialization(Bank()) >>Before the join
point:execution(Bank()) >>Before the join point:set(Bank
Nadia1.b) >>Before the join point:call(Bank()) >>Before the
join point:preinitialization(Bank()) >>Before the join
point:initialization(Bank()) >>Before the join
point:execution(Bank()) >>Before the join point:set(Bank
Nadia1.c)
My programs are the following:
/**************************************************/
class Nadia1 {
public static Bank b,c;
public static void main(String[] args) {
b=new Bank();
c=new Bank();}}
/***********************************************/
class Bank {}
/****************************************************/
aspect Lolo
{
pointcut p2():if (true) && !within (Lolo);
before(): p2() {
System.out.println(">>Before the join
point:"+thisJoinPoint);
}
}
Nadia.
|