aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2004-05-12 13:00:49 +0000
committeraclement <aclement>2004-05-12 13:00:49 +0000
commit913a5d035597bd7b6dfd12458ff38888e3978cec (patch)
tree73b82dca87a8775383e3760fb79f08022dfb79bf
parentb9ec4df1259123c4cccc09f5a8b0549b412ee071 (diff)
downloadaspectj-913a5d035597bd7b6dfd12458ff38888e3978cec.tar.gz
aspectj-913a5d035597bd7b6dfd12458ff38888e3978cec.zip
Fix for Bugzilla Bug 61568
wrong variable binding in || pointcuts
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/ExposedState.java1
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/NameBindingPointcut.java9
2 files changed, 9 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/ExposedState.java b/weaver/src/org/aspectj/weaver/patterns/ExposedState.java
index 8e130c689..063b5608e 100644
--- a/weaver/src/org/aspectj/weaver/patterns/ExposedState.java
+++ b/weaver/src/org/aspectj/weaver/patterns/ExposedState.java
@@ -35,6 +35,7 @@ public class ExposedState {
public void set(int i, Var var) {
//XXX add sanity checks
+ // Check (1) added to call of set(), verifies we aren't binding twice to the same formal
vars[i] = var;
}
public Var get(int i) {
diff --git a/weaver/src/org/aspectj/weaver/patterns/NameBindingPointcut.java b/weaver/src/org/aspectj/weaver/patterns/NameBindingPointcut.java
index 6fa9af440..593555d9f 100644
--- a/weaver/src/org/aspectj/weaver/patterns/NameBindingPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/NameBindingPointcut.java
@@ -13,6 +13,7 @@
package org.aspectj.weaver.patterns;
+import org.aspectj.bridge.MessageUtil;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.World;
import org.aspectj.weaver.ast.Test;
@@ -33,7 +34,13 @@ public abstract class NameBindingPointcut extends Pointcut {
protected Test exposeStateForVar(Var var,TypePattern type, ExposedState state, World world) {
if (type instanceof BindingTypePattern) {
BindingTypePattern b = (BindingTypePattern)type;
- state.set(b.getFormalIndex(), var);
+ if (state.get(b.getFormalIndex())!=null) {
+ world.getMessageHandler().handleMessage(MessageUtil.error(
+ "Ambiguous binding of type "+type.getExactType().toString()+". Use one args(..) per matched join point",
+ getSourceLocation()));
+ } else {
+ state.set(b.getFormalIndex(), var);
+ }
}
TypeX myType = type.getExactType(); //should have failed earlier