Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] access local variable in a method

You can't pick out get/set join points for local variables,
but you can get any non-null return value from any join
point that returns a value:

  after() returning (ClassA result) : call(ClassA.new(..)) {
    ...
  }

This is discussed in the FAQ and the Programming Guide.

Wes

gilbert.gao@xxxxxxxxxxx wrote:

Hi,

I have a question about accessing local variables. For example,

public class Test{

  public void run(){
     ClassA A = new ClassA();
doSomething(); } public void doSomething(){} }

How to access variable A in the run() method? I can write a pointcut to
pick up the line, "ClassA A = new ClassA()". However, as I know so far, we
only can expose context by using target, args, this. None of them can expose
the return value of a method or constructor.

Therefore, is it possible to get the value of A in this case?


Thanks,

Dapeng Gao



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




Back to the top