diff options
author | aclement <aclement> | 2008-04-26 18:38:32 +0000 |
---|---|---|
committer | aclement <aclement> | 2008-04-26 18:38:32 +0000 |
commit | 6e4d4bdf9fa5f2dee613932c8ada32606724b7b9 (patch) | |
tree | 7723b8525820d610d1a260211c576148c2397fde | |
parent | 95fd0b5d754806866d836e56e15b9ecb8a3fa1ee (diff) | |
download | aspectj-6e4d4bdf9fa5f2dee613932c8ada32606724b7b9.tar.gz aspectj-6e4d4bdf9fa5f2dee613932c8ada32606724b7b9.zip |
rest of fix for 228980 - annotations bundled in with Nots
-rw-r--r-- | weaver/src/org/aspectj/weaver/patterns/PatternParser.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/PatternParser.java b/weaver/src/org/aspectj/weaver/patterns/PatternParser.java index 72f96109f..0f23a3d7e 100644 --- a/weaver/src/org/aspectj/weaver/patterns/PatternParser.java +++ b/weaver/src/org/aspectj/weaver/patterns/PatternParser.java @@ -687,13 +687,31 @@ public class PatternParser { if (maybeEat("!")) { //int startPos = tokenSource.peek(-1).getStart(); //??? we lose source location for true start of !type - TypePattern p = new NotTypePattern(parseAtomicTypePattern(insideTypeParameters,parameterAnnotationsPossible)); - p = setAnnotationPatternForTypePattern(p,ap,false); + + // An annotation, if processed, is outside of the Not - so here we have to build + // an And pattern containing the annotation and the not as left and right children + // *unless* the annotation pattern was just 'Any' then we can skip building the + // And and just return the Not directly (pr228980) + TypePattern p = null; + TypePattern tp = parseAtomicTypePattern(insideTypeParameters,parameterAnnotationsPossible); + if (!(ap instanceof AnyAnnotationTypePattern)) { + p = new NotTypePattern(tp); + p = new AndTypePattern(setAnnotationPatternForTypePattern(TypePattern.ANY,ap,false),p); + } else { + p = new NotTypePattern(tp); + } return p; } if (maybeEat("(")) { TypePattern p = parseTypePattern(insideTypeParameters,false); - p = setAnnotationPatternForTypePattern(p,ap,parameterAnnotationsPossible); + if ((p instanceof NotTypePattern) && !(ap instanceof AnyAnnotationTypePattern)) { + // dont set the annotation on it, we don't want the annotation to be + // considered as part of the not, it is outside the not (pr228980) + TypePattern tp = setAnnotationPatternForTypePattern(TypePattern.ANY, ap, parameterAnnotationsPossible); + p = new AndTypePattern(tp,p); + } else { + p = setAnnotationPatternForTypePattern(p,ap,parameterAnnotationsPossible); + } eat(")"); boolean isVarArgs = maybeEat("..."); if (isVarArgs) p.setIsVarArgs(isVarArgs); |