summaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2005-10-27 13:49:34 +0000
committeraclement <aclement>2005-10-27 13:49:34 +0000
commit6ab78ee0e1d49a0e3f882ddf604061dc572cb427 (patch)
tree6be694492a79b00b680c4954c9459ca3f8e789db /weaver
parentfa21e62717f87e3f84b74dcedc36d79951ec0751 (diff)
downloadaspectj-6ab78ee0e1d49a0e3f882ddf604061dc572cb427.tar.gz
aspectj-6ab78ee0e1d49a0e3f882ddf604061dc572cb427.zip
test and fix for pr113447: from Helen.
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
index b458c5d97..da23506ea 100644
--- a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
@@ -179,17 +179,19 @@ public class ThisOrTargetPointcut extends NameBindingPointcut {
if (type instanceof BindingTypePattern) {
BindingTypePattern btp = (BindingTypePattern)type;
// Check if we have already bound something to this formal
- if ((state.get(btp.getFormalIndex())!=null) && (lastMatchedShadowId != shadow.shadowId)){
-// ISourceLocation pcdSloc = getSourceLocation();
-// ISourceLocation shadowSloc = shadow.getSourceLocation();
-// Message errorMessage = new Message(
-// "Cannot use "+(isThis?"this()":"target()")+" to match at this location and bind a formal to type '"+var.getType()+
-// "' - the formal is already bound to type '"+state.get(btp.getFormalIndex()).getType()+"'"+
-// ". The secondary source location points to the problematic "+(isThis?"this()":"target()")+".",
-// shadowSloc,true,new ISourceLocation[]{pcdSloc});
-// shadow.getIWorld().getMessageHandler().handleMessage(errorMessage);
+ Var existingVarInThisSlot = state.get(btp.getFormalIndex());
+
+ if (existingVarInThisSlot != null ) {
+
+ // Is it already bound to exactly the same thing?
+ if (existingVarInThisSlot.equals(var)) return Literal.TRUE;
+
+ // If state.get() returned non-null then someone has already bound the variable in that slot at
+ // the shadow 'shadow.shadowId'. If our 'lastMatchedShadowId' is not the same as 'shadow.shadowId'
+ // then this pointcut wasn't involved in matching and so shouldn't contribute to binding - so just
+ // return Literal.TRUE meaning 'no residue'
+ if (lastMatchedShadowId != shadow.shadowId) return Literal.TRUE;
state.setErroneousVar(btp.getFormalIndex());
- //return null;
}
}
return exposeStateForVar(var, type, state, shadow.getIWorld());