diff options
author | acolyer <acolyer> | 2005-03-22 13:14:44 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-03-22 13:14:44 +0000 |
commit | b5f4d09e4f4e45943c6c8b3dc8dca0c05b90f27c (patch) | |
tree | fd62ccc09921d51f4e59007ddf5205ff5df9f1dc /weaver | |
parent | 8e275e3b934fd973ca04e358e994e50e9668b415 (diff) | |
download | aspectj-b5f4d09e4f4e45943c6c8b3dc8dca0c05b90f27c.tar.gz aspectj-b5f4d09e4f4e45943c6c8b3dc8dca0c05b90f27c.zip |
Fix for Bugzilla Bug 88652: an array type as the last parameter in a signature does not match on the varargs declared method
Diffstat (limited to 'weaver')
4 files changed, 17 insertions, 4 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java index b4e4ea7e3..6776579f3 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java @@ -70,6 +70,10 @@ public class ExactTypePattern extends TypePattern { this.type = type; } + public boolean isArray() { + return type.isArray(); + } + /* (non-Javadoc) * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern) */ diff --git a/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java b/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java index 126d45e95..633e15748 100644 --- a/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java @@ -573,11 +573,12 @@ public class SignaturePattern extends PatternNode { * was declared with varargs (Object...). We shouldn't be matching if this is the case. */ private boolean isNotMatchBecauseOfVarargsIssue(TypePatternList params,int modifiers) { - if (params.size()>0 && (modifiers & Constants.ACC_VARARGS)!=0 && // XXX Promote this to an isVarargs() on MethodSignature? - !params.get(params.size()-1).isVarArgs) { - return true; + if (params.size()>0 && (modifiers & Constants.ACC_VARARGS)!=0) { + // we have at least one parameter in the pattern list, and the method has a varargs signature + TypePattern lastPattern = params.get(params.size()-1); + if (lastPattern.isArray() && !lastPattern.isVarArgs) return true; } - return false; + return false; } public AnnotationTypePattern getAnnotationPattern() { diff --git a/weaver/src/org/aspectj/weaver/patterns/TypePattern.java b/weaver/src/org/aspectj/weaver/patterns/TypePattern.java index 9763cf9e7..dd33ef30a 100644 --- a/weaver/src/org/aspectj/weaver/patterns/TypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/TypePattern.java @@ -64,6 +64,10 @@ public abstract class TypePattern extends PatternNode { return annotationPattern == AnnotationTypePattern.ANY; } + public boolean isArray() { + return false; + } + protected TypePattern(boolean includeSubtypes) { this(includeSubtypes,false); } diff --git a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java index 0dff4aaad..859391bdf 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java @@ -140,6 +140,10 @@ public class WildTypePattern extends TypePattern { return dim; } + public boolean isArray() { + return dim > 1; + } + /** * @param targetTypeName * @return |