diff options
author | acolyer <acolyer> | 2005-09-06 11:02:20 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-09-06 11:02:20 +0000 |
commit | 8459fc93a9f455b2669ed2a758b10bdc6cd3903a (patch) | |
tree | 27675c6cfdfca2eb44a9cb987b9121311f6514ad | |
parent | 752a7b4b45d02495ca1610d1a941d4feafc80bae (diff) | |
download | aspectj-8459fc93a9f455b2669ed2a758b10bdc6cd3903a.tar.gz aspectj-8459fc93a9f455b2669ed2a758b10bdc6cd3903a.zip |
fix for pr108818, if the declaring type of the member refering to this pointcut has a private matching pointcut, then use that rather than any with the same name in a sub-aspect.
-rw-r--r-- | weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java index 15e6f8cfd..39afad012 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java @@ -251,7 +251,10 @@ public class ReferencePointcut extends Pointcut { //??? This is not thread safe, but this class is not designed for multi-threading private boolean concretizing = false; - public Pointcut concretize1(ResolvedType searchStart, IntMap bindings) { + // declaring type is the type that declared the member referencing this pointcut. + // If it declares a matching private pointcut, then that pointcut should be used + // and not one in a subtype that happens to have the same name. + public Pointcut concretize1(ResolvedType searchStart, ResolvedType declaringType, IntMap bindings) { if (concretizing) { //Thread.currentThread().dumpStack(); searchStart.getWorld().getMessageHandler().handleMessage( @@ -270,13 +273,19 @@ public class ReferencePointcut extends Pointcut { return Pointcut.makeMatchesNothing(Pointcut.CONCRETE); } } - pointcutDec = searchStart.findPointcut(name); - if (pointcutDec == null) { - searchStart.getWorld().getMessageHandler().handleMessage( - MessageUtil.error(WeaverMessages.format(WeaverMessages.CANT_FIND_POINTCUT,name,searchStart.getName()), - getSourceLocation()) - ); - return Pointcut.makeMatchesNothing(Pointcut.CONCRETE); + + if (declaringType == null) declaringType = searchStart; + pointcutDec = declaringType.findPointcut(name); + boolean foundMatchingPointcut = (pointcutDec != null && pointcutDec.isPrivate()); + if (!foundMatchingPointcut) { + pointcutDec = searchStart.findPointcut(name); + if (pointcutDec == null) { + searchStart.getWorld().getMessageHandler().handleMessage( + MessageUtil.error(WeaverMessages.format(WeaverMessages.CANT_FIND_POINTCUT,name,searchStart.getName()), + getSourceLocation()) + ); + return Pointcut.makeMatchesNothing(Pointcut.CONCRETE); + } } if (pointcutDec.isAbstract()) { @@ -327,7 +336,7 @@ public class ReferencePointcut extends Pointcut { try { Pointcut ret = pointcutDec.getPointcut(); if (typeVariableMap != null) ret = ret.parameterizeWith(typeVariableMap); - return ret.concretize(searchStart, newBindings); + return ret.concretize(searchStart, declaringType, newBindings); } finally { newBindings.popEnclosingDefinitition(); } |