Bug 92326

Summary: Align JoinPoint getters with context changes
Product: [Tools] AspectJ Reporter: Wes Isberg <wes>
Component: CompilerAssignee: Adrian Colyer <adrian.colyer>
Status: NEW --- QA Contact:
Severity: major    
Priority: P3    
Version: 1.5.0M3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Wes Isberg CLA 2005-04-21 23:17:05 EDT
I was surprised to find that after changing the target at a join point using
proceed({target}), thisJoinPoint.getTarget() continued to return the original
target.  (Same result with inline/noinline and lazy join point or not.)  

It seems wrong to get different results for the "same" (reference) value when
obtained via different means.  (This blocks a point I'm making in the article
about advice interactions.)  On the other hand, I wonder if anyone is relying on
this bug.  

Below is a demo program; if we agree this is a bug, I can convert to a test case
along with those for other context variables.

--------------- errors/TargetUnchanged.java
package errors;


public class TargetUnchanged {

    public static void main(String[] args) {
        new C().run();
    }
    static class C {
        static int COUNT;
        final int count = COUNT++;
        void run() {}
        public String toString() {
            return "C-" + count;
        }
    }
    static aspect A {
        void around(C c) : target(c) && execution(void C.run()) {
            proceed(new C());
            proceed(new C());
            proceed(c);
        }
    }
    static aspect B {
        declare precedence: A, B;
        before(C c) : target(c) && execution(void C.run()) {
            System.out.println("c: " + c 
                    + " targ: " + thisJoinPoint.getTarget());
        }
    }
}