Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] About join points for local variables.

Adding to that, if you wanna do what you said you wanna do you are
probably not actually not really interested in doing AOP but rather
program analysis. Hence, you probably might want to use appropriate
tools, (I can recommend Soot from www.sable.mcgill.ca/soot) which also
allow you access to (reconstructed "dummy") local variables for your
particular purpose.

Eric  

> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx 
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Ron DiFrango
> Sent: Thursday, April 06, 2006 2:35 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: RE: [aspectj-users] About join points for local variables.
> 
> Sunny,
>  
> If a local variable is an object, you could trap the creation 
> of the object via something like:
>  
> call(*.new(..))
>  
> The you could use standard reflection to see which object you are in.
>  
> For parameters into methods you, can use generic around advice:
>  
> aspect Logging {
>      before(): within(com.bigboxco..*) && execution(public * *(..)) {
>          System.err.println("entering: " + thisJoinPoint);
>          System.err.println("  w/args: " + thisJoinPoint.getArgs());
>          System.err.println("      at: " + 
> thisJoinPoint.getSourceLocation());
>      }
> }
>  
> See the JavaDoc for the runtime API:
>  
> http://www.eclipse.org/aspectj/doc/released/runtime-api/index.html
>  
> Ron
> 
> ________________________________
> 
> From: aspectj-users-bounces@xxxxxxxxxxx on behalf of Sunny
> Sent: Thu 4/6/2006 1:10 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: [aspectj-users] About join points for local variables.
> 
> 
> Dear Folks,
>  
> After reading the AspectJ FAQ No. 21: "Why can't AspectJ pick 
> out local variables (or array elements or ...)?"
>  
> I have the following question:
>  
> What I would like to do is to dynamically maintain an object 
> graph (directed), where nodes represent runtime objects and 
> directed edges denote reference relationships between 
> objects. Apparently an object can refer to other objects not 
> only through its fields, but also through its local variables 
> or parameters. Without join point for local/parameters, how 
> would I accurately obtain the current system state info (in 
> terms of relationships between objects)? 
>  
> Is there any other way that I can achieve the same goal? I 
> appreciate your help!
>  
> Sunny
> 


Back to the top