Skip to main content

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


On Mar 27, 2008, at 1:47 PM, Reema Koo wrote:
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 =
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,
Is there some way in aspectj to say, “tell me when ‘x’ gets loaded”.

Any information would be appreciated. 

Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now._______________________________________________
aspectj-users mailing list

Dean Wampler, Ph.D.
dean at
See also:     AOP for Ruby         Design by Contract for Java5

Back to the top