Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] "Perreturned" instantiation

Hi Eric -

What would one do with this language feature?

perthis and pertarget aspects have the nice property of holding state for target state (this, target) that persists throughout a join point and thus is relevant during the execution of any advice on such join points.  Here, the return value is only available after the join point returns (though perhaps multiple times).  Further, you're asking for the aspect to be instantiated only after the joint point is executed, even though instantiating the aspect is required to run advice.  

Should one not implement simple association as a map?  Aspect association involves these additional semantics of pointcut dependency (no advice runs unless the aspect is instantiated) which might not be apt for return values or thrown exceptions.

Curious -
Wes

> ------------Original Message------------
> From: Eric Bodden <eric@xxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Wed, Nov-10-2004 10:06 AM
> Subject: [aspectj-users] "Perreturned" instantiation
>
>  
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi.
> 
> I am trying to have an aspect instantiated whenever a certain method
> call returns some specific object and then want to associate the
> aspect instance with that object, so something like:
> 
> aspect Foo perreturned (call(B A.bar(..))) {
> 	
> 	after() returning(B b): call(B A.bar(..)) {
> 		//do something with this particular instance b of type B
> 	}
> 
> }
> 
> I imagine that one could probably simulate that somehow with a piece
> of around advice (to retrieve the returned object), but then, still,
> since I cannot instanciate an aspect explicitly, how could I
> associate a distinct aspect instance with that object.
> 
> (Similar to that one could also of course postulate a perthrown
> clause.)
> 
> Thanks in advance,
> Eric
> 
> - -- 
> Eric Bodden
> Chair I2 for Programming Languages and Program Analysis
> RWTH Aachen University
> 
> -----BEGIN PGP SIGNATURE-----
> Version: PGP 8.0.3
> 
> iQA/AwUBQZJX8swiFCm7RlWCEQLA4gCgi4WegtJs2KInczN4h4g4zP0AMmEAnA+b
> nzDzzv2wC71PXQUhKC5Qbu4J
> =WCnz
> -----END PGP SIGNATURE-----
> 
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 




Back to the top