From: aclement Date: Wed, 12 May 2004 13:00:49 +0000 (+0000) Subject: Fix for Bugzilla Bug 61568 X-Git-Tag: V1_2_0~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=913a5d035597bd7b6dfd12458ff38888e3978cec;p=aspectj.git Fix for Bugzilla Bug 61568 wrong variable binding in || pointcuts --- 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