]> source.dussan.org Git - aspectj.git/commitdiff
final(?) @args fixes
authoracolyer <acolyer>
Fri, 10 Dec 2004 11:27:26 +0000 (11:27 +0000)
committeracolyer <acolyer>
Fri, 10 Dec 2004 11:27:26 +0000 (11:27 +0000)
weaver/src/org/aspectj/weaver/patterns/AnnotationPatternList.java
weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java

index daca99502043b3e9aefe40ff9b97aa02c27f29c6..a5e8cc4cdca52f5e38ffbe5991ebffa766aebe04 100644 (file)
@@ -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);
index 66d771c14e77a4149f25adafa2c2d0798337b0d5..363e279284fa7edf547d013ee97a44f7c0d8b6d4 100644 (file)
@@ -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++;
                                }                               
                        }
                }