diff options
author | aclement <aclement> | 2006-05-17 15:48:34 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-05-17 15:48:34 +0000 |
commit | 6b2d9ae90158bd4e5cda5ecea5f3787400bab5af (patch) | |
tree | 1cfeecc8b5648b462968e636128686fb2e99bbd4 /weaver | |
parent | 2c5fd746cb28ed8ad3990229ea2f861bbb815821 (diff) | |
download | aspectj-6b2d9ae90158bd4e5cda5ecea5f3787400bab5af.tar.gz aspectj-6b2d9ae90158bd4e5cda5ecea5f3787400bab5af.zip |
test update and fix for 138223: funky annotation matching
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java index 883f93fb6..ede464f11 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java @@ -22,7 +22,6 @@ import org.aspectj.bridge.MessageUtil; import org.aspectj.util.FuzzyBoolean; import org.aspectj.weaver.AjcMemberMaker; import org.aspectj.weaver.AnnotatedElement; -import org.aspectj.weaver.BCException; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.IntMap; import org.aspectj.weaver.Member; @@ -194,12 +193,23 @@ public class AnnotationPointcut extends NameBindingPointcut { UnresolvedType annotationType = btp.getAnnotationType(); Var var = shadow.getKindedAnnotationVar(annotationType); - // This should not happen, we shouldn't have gotten this far - // if we weren't going to find the annotation - if (var == null) throw new BCException("Impossible! annotation=["+annotationType+ - "] shadow=["+shadow+" at "+shadow.getSourceLocation()+ - "] pointcut is at ["+getSourceLocation()+"]");//return Literal.FALSE; - + // At this point, var *could* be null. The only reason this could happen (if we aren't failing...) + // is if another binding annotation designator elsewhere in the pointcut is going to expose the annotation + // eg. (execution(* a*(..)) && @annotation(foo)) || (execution(* b*(..)) && @this(foo)) + // where sometimes @annotation will be providing the value, and sometimes + // @this will be providing the value (see pr138223) + + // If we are here for other indecipherable reasons (it's not the case above...) then + // you might want to uncomment this next bit of code to collect the diagnostics +// if (var == null) throw new BCException("Impossible! annotation=["+annotationType+ +// "] shadow=["+shadow+" at "+shadow.getSourceLocation()+ +// "] pointcut is at ["+getSourceLocation()+"]"); + if (var==null) { + if (matchInternal(shadow).alwaysTrue()) + return Literal.TRUE; + else + return Literal.FALSE; + } state.set(btp.getFormalIndex(),var); } if (matchInternal(shadow).alwaysTrue()) |