From 6e4d4bdf9fa5f2dee613932c8ada32606724b7b9 Mon Sep 17 00:00:00 2001 From: aclement Date: Sat, 26 Apr 2008 18:38:32 +0000 Subject: [PATCH] rest of fix for 228980 - annotations bundled in with Nots --- .../weaver/patterns/PatternParser.java | 24 ++++++++++++++++--- 1 file 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); -- 2.39.5