[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] aspects on variables

AspectJ can watch gets and sets of attributes in an object, but not local variables. If you have to watch a local variable, your only option is to write aspects for its type, such as the type's methods and attributes.

Dean

On Mar 27, 2008, at 1:47 PM, Reema Koo wrote:
Hi,
There are two things I’m trying to do with aspectj, and I can’t seem to find any info about them in the documentation so I’m not sure if aspectj supports them.
1. I’d like to write an aspect for a variable after an assignment.  For example, if I had a piece of code that looked like this:
x = a.foo()
I’d like to write an aspect for the LHS so that I can know that the variable is “x”, and figure out it’s location.

2. Similiarly, when “x” gets used in an api call later, I’d like to be able to know it is being used.  For example,  
a.bar(x)
Is there some way in aspectj to say, “tell me when ‘x’ gets loaded”.

Any information would be appreciated. 
Thanks,
Reema


Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now._______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Dean Wampler, Ph.D.
dean at objectmentor.com
See also:
http://aquarium.rubyforge.org     AOP for Ruby
http://www.contract4j.org         Design by Contract for Java5