Skip to main content

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

Thanks Jochen.

By Late binding means dynamic binding like
          A obj = new B();

So there is no possibility to weave local variables assignments with AspectJ.

And for member variables, Advicing Setter method is the only way?

--- On Fri, 10/10/08, Jochen Wuttke <jochen.wuttke@xxxxxx> wrote:
From: Jochen Wuttke <jochen.wuttke@xxxxxx>
Subject: Re: [aspectj-users] Logging variables
To: aspectj-users@xxxxxxxxxxx
Date: Friday, October 10, 2008, 6:32 AM

On Oct 10, 2008, at 2:41 PM, rmahmood wrote:

>
> Hi All,
>
> i am looking for some way to weave variable assignment statements.
>>> From different discussions it seems that the only possibility is
to
> advice Setter methods for member variable assignment.
>
> But what about local variables within a method or assignment to
> a variable by a method return value.
>
> For assignments with late bindings it looks that this is not possible
> with AspectJ as it provides load time weaving.

I'm not sure what you mean by "late bindings". But the problem
with AJ
is, AFAIK, that the names of local variables are not stored in class
files, i.e. they are not available for weaving. Instead the Java
compiler assigns them numbers (which show up in the class file for
LOAD instructions), but since there is no mapping between these
numbers and the named variables in the source that the AspectJ weaver
has access to, it is not possible to weave into local variable accesses.

Jochen
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top