diff options
author | Andy Clement <aclement@pivotal.io> | 2016-11-18 09:00:28 -0800 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2016-11-18 09:00:28 -0800 |
commit | b6f2b6337fbaf95b78c20862cd90f0e027509531 (patch) | |
tree | da38bdf8ab392b0e6f49da7a676a75f885fe9b85 /runtime | |
parent | e8be95bbfd291f93319d1a1e9920e44cd7eb7569 (diff) | |
download | aspectj-b6f2b6337fbaf95b78c20862cd90f0e027509531.tar.gz aspectj-b6f2b6337fbaf95b78c20862cd90f0e027509531.zip |
Fix 500035: handling target only binding in @AJ pointcut
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/src/org/aspectj/runtime/reflect/JoinPointImpl.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/runtime/src/org/aspectj/runtime/reflect/JoinPointImpl.java b/runtime/src/org/aspectj/runtime/reflect/JoinPointImpl.java index cae6cf577..69bff1e3c 100644 --- a/runtime/src/org/aspectj/runtime/reflect/JoinPointImpl.java +++ b/runtime/src/org/aspectj/runtime/reflect/JoinPointImpl.java @@ -197,9 +197,17 @@ class JoinPointImpl implements ProceedingJoinPoint { } else { // need to replace the target, and it is different to this, whether // that means replacing state[0] or state[1] depends on whether - // the join point has a this - firstArgumentIndexIntoAdviceBindings = (hasThis ? 1 : 0) + 1; - state[hasThis ? 1 : 0] = adviceBindings[hasThis ? 1 : 0]; + // the join point has a this + + // This previous variant doesn't seem to cope with only binding target at a joinpoint + // which has both this and target. It forces you to supply this even if you didn't bind + // it. +// firstArgumentIndexIntoAdviceBindings = (hasThis ? 1 : 0) + 1; +// state[hasThis ? 1 : 0] = adviceBindings[hasThis ? 1 : 0]; + + int targetPositionInAdviceBindings = (hasThis && bindsThis) ? 1 : 0; + firstArgumentIndexIntoAdviceBindings = ((hasThis&&bindsThis)?1:0)+((hasTarget&&bindsTarget&&!thisTargetTheSame)?1:0); + state[hasThis ? 1 : 0] = adviceBindings[targetPositionInAdviceBindings]; } } else { // leave state[0]/state[1] alone, they are OK |