From b06338f1b60de75f7b38810be5652a363c63788b Mon Sep 17 00:00:00 2001 From: acolyer Date: Fri, 10 Dec 2004 11:27:26 +0000 Subject: [PATCH] final(?) @args fixes --- .../org/aspectj/weaver/patterns/AnnotationPatternList.java | 4 ++-- .../org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java b/weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java index daca99502..a5e8cc4cd 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java +++ b/weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java @@ -61,7 +61,7 @@ public class AnnotationPatternList extends PatternNode { public FuzzyBoolean matches(ResolvedTypeX[] someArgs) { // do some quick length tests first - int numArgsMatchedByEllipsis = (someArgs.length + ellipsisCount) - typePatterns.length; + int numArgsMatchedByEllipsis = (someArgs.length + ellipsisCount) - typePatterns.length; if (numArgsMatchedByEllipsis < 0) return FuzzyBoolean.NO; if ((numArgsMatchedByEllipsis > 0) && (ellipsisCount == 0)) { return FuzzyBoolean.NO; @@ -81,7 +81,7 @@ public class AnnotationPatternList extends PatternNode { ExactAnnotationTypePattern ap = (ExactAnnotationTypePattern)typePatterns[i]; FuzzyBoolean matches = ap.matches(someArgs[argsIndex]); if (matches == FuzzyBoolean.NO) { - return FuzzyBoolean.NO; + return FuzzyBoolean.MAYBE; // could still match at runtime } else { argsIndex++; ret = ret.and(matches); diff --git a/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java index 66d771c14..363e27928 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java @@ -119,7 +119,7 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut { // match the argument type at argsIndex with the ExactAnnotationTypePattern // we know it is exact because nothing else is allowed in args ExactAnnotationTypePattern ap = (ExactAnnotationTypePattern)arguments.get(i); - TypeX argType = shadow.getArgType(i); + TypeX argType = shadow.getArgType(argsIndex); ResolvedTypeX rArgType = argType.resolve(shadow.getIWorld()); if (rArgType == ResolvedTypeX.MISSING) { IMessage msg = new Message( @@ -127,12 +127,14 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut { "",IMessage.ERROR,shadow.getSourceLocation(),null,new ISourceLocation[]{getSourceLocation()}); } if (ap.matches(rArgType).alwaysTrue()) { + argsIndex++; continue; } else { // we need a test... // TODO: binding ResolvedTypeX rAnnType = ap.annotationType.resolve(shadow.getIWorld()); - ret = Test.makeAnd(ret,Test.makeHasAnnotation(shadow.getArgVar(i),rAnnType)); + ret = Test.makeAnd(ret,Test.makeHasAnnotation(shadow.getArgVar(argsIndex),rAnnType)); + argsIndex++; } } } -- 2.39.5