aboutsummaryrefslogtreecommitdiffstats
path: root/weaver/src
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-12-16 11:04:19 +0000
committeracolyer <acolyer>2004-12-16 11:04:19 +0000
commitee0b12f950c0c24acf8df868e529385aec523c06 (patch)
tree846bd7e6e668e8608ca146586fca1cefa14ffa32 /weaver/src
parentded1a744fc4a518275dbb4fcfa219939ae48ad11 (diff)
downloadaspectj-ee0b12f950c0c24acf8df868e529385aec523c06.tar.gz
aspectj-ee0b12f950c0c24acf8df868e529385aec523c06.zip
it is now safe to short-circuit in and/or pc matching (all side-effects removed)
Diffstat (limited to 'weaver/src')
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/AndPointcut.java4
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/OrPointcut.java4
2 files changed, 6 insertions, 2 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java b/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java
index 1775ba3db..dcb951d46 100644
--- a/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java
@@ -53,7 +53,9 @@ public class AndPointcut extends Pointcut {
}
protected FuzzyBoolean matchInternal(Shadow shadow) {
- return left.match(shadow).and(right.match(shadow));
+ FuzzyBoolean leftMatch = left.match(shadow);
+ if (leftMatch.alwaysFalse()) return leftMatch;
+ return leftMatch.and(right.match(shadow));
}
public FuzzyBoolean match(JoinPoint jp, JoinPoint.StaticPart encJP) {
diff --git a/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java b/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java
index e204ef329..2eca6de01 100644
--- a/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java
@@ -51,7 +51,9 @@ public class OrPointcut extends Pointcut {
}
protected FuzzyBoolean matchInternal(Shadow shadow) {
- return left.match(shadow).or(right.match(shadow));
+ FuzzyBoolean leftMatch = left.match(shadow);
+ if (leftMatch.alwaysTrue()) return leftMatch;
+ return leftMatch.or(right.match(shadow));
}
public FuzzyBoolean match(JoinPoint jp, JoinPoint.StaticPart encJP) {