summaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authoraclement <aclement>2009-11-13 18:24:12 +0000
committeraclement <aclement>2009-11-13 18:24:12 +0000
commitdb70f92aa10ee2fbf15f5ec1e2ed3d68cc2b6baf (patch)
tree4d61677663b581175147de3918a31599ba014426 /org.aspectj.matcher
parentbbe9ce4a1929279ddff6cda6394863a311beb231 (diff)
downloadaspectj-db70f92aa10ee2fbf15f5ec1e2ed3d68cc2b6baf.tar.gz
aspectj-db70f92aa10ee2fbf15f5ec1e2ed3d68cc2b6baf.zip
faster parametercount checking
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java
index 00eea30e4..52115f7e4 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java
@@ -436,22 +436,25 @@ public class SignaturePattern extends PatternNode {
// just give up early (for now)
return false;
}
+
int patternParameterCount = parameterTypes.size();
- int joinpointParameterCount = methodJoinpoint.getParameterTypes().length;
- boolean isVarargs = methodJoinpoint.isVarargsMethod();
- // Quick rule: pattern specifies zero parameters, and joinpoint has parameters *OR*
- if (patternParameterCount == 0 && joinpointParameterCount > 0) { // varargs may allow this
- return true;
- }
+ if (patternParameterCount == 0 || parameterTypes.ellipsisCount == 0) {
+ boolean equalCount = patternParameterCount == methodJoinpoint.getParameterTypes().length;
- // Quick rule: pattern doesn't specify ellipsis and there are a different number of parameters on the
- // method join point as compared with the pattern
- if (parameterTypes.ellipsisCount == 0 && patternParameterCount != joinpointParameterCount) {
- if (patternParameterCount > 0 && parameterTypes.get(patternParameterCount - 1).isVarArgs()) {
- return false;
+ // Quick rule: pattern specifies zero parameters, and joinpoint has parameters *OR*
+ if (patternParameterCount == 0 && !equalCount) {
+ return true;
+ }
+
+ // Quick rule: pattern doesn't specify ellipsis and there are a different number of parameters on the
+ // method join point as compared with the pattern
+ if (parameterTypes.ellipsisCount == 0 && !equalCount) {
+ if (patternParameterCount > 0 && parameterTypes.get(patternParameterCount - 1).isVarArgs()) {
+ return false;
+ }
+ return true;
}
- return true;
}
return false;