Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] Set-Pointcut does not match

 
-----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-----




Back to the top