Community
Participate
Working Groups
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()); } } }