diff options
author | Andy Clement <aclement@pivotal.io> | 2019-02-19 12:25:01 -0800 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2019-02-19 12:25:01 -0800 |
commit | 8819fad9f47fe572c45e601d7f321fe4ddf50b9e (patch) | |
tree | 6f3b7a4cfdd6e2d33796d50bd5dc96ff92c92eda /org.aspectj.matcher | |
parent | b858c788515524c2224165fc615638b75266954f (diff) | |
download | aspectj-8819fad9f47fe572c45e601d7f321fe4ddf50b9e.tar.gz aspectj-8819fad9f47fe572c45e601d7f321fe4ddf50b9e.zip |
333274: more tests and fixes: nested @Around advice with proceed
Diffstat (limited to 'org.aspectj.matcher')
3 files changed, 28 insertions, 1 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java index d6c8ea87f..cd786e724 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java @@ -83,6 +83,10 @@ public abstract class Advice extends ShadowMunger { ret.concreteAspect = inAspect; return ret; } + + public boolean isAroundAdvice() { + return attribute.getKind() == AdviceKind.Around; + } public static Advice makeSoftener(World world, Pointcut entry, TypePattern exceptionType, ResolvedType inAspect, IHasSourceLocation loc) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java index 587d19c15..1a8ed5290 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java @@ -46,7 +46,8 @@ public abstract class Shadow { private ResolvedMember resolvedSignature; protected final Shadow enclosingShadow; protected List<ShadowMunger> mungers = Collections.emptyList(); - + protected boolean needAroundClosureStacking = false; + public int shadowId = nextShadowID++; // every time we build a shadow, it gets a new id // ---- @@ -628,6 +629,20 @@ public abstract class Shadow { /** Actually implement the (non-empty) mungers associated with this shadow */ private void implementMungers() { World world = getIWorld(); + needAroundClosureStacking = false; + int annotationStyleWithAroundAndProceedCount = 0; + for (ShadowMunger munger: mungers) { + if (munger.getDeclaringType()!= null && + munger.getDeclaringType().isAnnotationStyleAspect() && + munger.isAroundAdvice() && + munger.bindsProceedingJoinPoint()) { + annotationStyleWithAroundAndProceedCount++; + if (annotationStyleWithAroundAndProceedCount>1) { + needAroundClosureStacking = true; + break; + } + } + } for (ShadowMunger munger : mungers) { if (munger.implementOn(this)) { world.reportMatch(munger, this); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ShadowMunger.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ShadowMunger.java index c07d7e8e7..a0e49becc 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ShadowMunger.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ShadowMunger.java @@ -303,5 +303,13 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH // } // newShadowMunger.binaryFile = null; // } + + public boolean bindsProceedingJoinPoint() { + return false; + } + + public boolean isAroundAdvice() { + return false; + } } |