[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-dev] Set-Pointcut does not match
|
Ok, I can't work it out, so I suggest you sneak up on the problem
sideways. Write a method that simply sets the state to two and then see
if that triggers your advice. Perhaps there's a problem with your
pointcut.
Not much help, but that's how I'd approach it.
Cheers,
Nick
On Aug 11, 2004, at 8:41 AM, Eric Bodden wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi.
Could probably anybody explain to me, while the last advice here
never matches?
package rv;
aspect PushUntilPop pertarget(pushPop()){
int state = 0;
public PushUntilPop() {
System.out.println("new instance "+this);
}
pointcut pushPop() : pu(Object) || po();
pointcut pu(Object o): call(* IStack.push(..)) && args(o);
pointcut po(): call(* IStack.pop());
pointcut match(): set(* PushUntilPop.state);
after() returning (Object o): po() {
if(state==0) {
System.out.println("0->2"+this);
state=2;
}
}
after(Object o) returning: pu(o) {
if(state==0) {
System.out.println("0->1"+this);
state=1;
}
}
after() returning (Object o): po() {
if(state==1) {
System.out.println("1->2"+this);
state=2;
}
}
after(Object o) returning: pu(o) {
if(state==1) {
System.out.println("1->1"+this);
state=1;
}
}
before(): set(* state) {
if(state==2)
System.out.println("Matched."+this);
}
after(): execution(public static void main(String[])) {
System.out.println(state);
}
void foo() {
System.out.println();
}
}
I am never seeing the output "Matched." - though the other advices
function and the state is set to 2 at some point. The whole advice is
never executed. But as you can easily see any of the others *does*
set the field "state".
Strange...
Eric
- --
Eric Bodden
Chair I2 for Programming Languages and Program Analysis
RWTH Aachen University
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3
iQA/AwUBQRo+OMwiFCm7RlWCEQIYZgCgtko0jpBBnbDClg/OgkzgoHmFm2MAoMGT
v98tNcsJITK5FsHEyMIBL+XR
=Iatu
-----END PGP SIGNATURE-----
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev
Nicholas Lesiecki
Software Craftsman, specializing in J2EE,
Agile Methods, and aspect-oriented programming
Books:
* Mastering AspectJ: http://tinyurl.com/66vf
* Java Tools for Extreme Programming: http://tinyurl.com/66vt
Articles on AspectJ:
* http://tinyurl.com/66vu and http://tinyurl.com/66vv