Hi
Nadia,
The programmers
guide has a good definition of the different join points, including the
various initialization ones: http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/progguide/semantics-joinPoints.html
For #2, your before
advice in Lolo was executing on staticinitialization of the Lolo aspect, which
failed because the aspect wasnt yet initialized. You already figured out the
way to avoid the problem J
From:
aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx]
On Behalf Of Nadia
Guerroumi
Sent: Tuesday,
March 29, 2005 6:14 AM
To:
aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users]
staticinitialization,
preinitialization,initialization??
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:
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.