Bug 92326 - Align JoinPoint getters with context changes
Summary: Align JoinPoint getters with context changes
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M3   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-21 23:17 EDT by Wes Isberg CLA
Modified: 2005-04-21 23:17 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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());
        }
    }
}