diff options
author | acolyer <acolyer> | 2005-11-24 13:02:32 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-11-24 13:02:32 +0000 |
commit | b3be9410fcd333a516e6a220d30f9705b7aa9748 (patch) | |
tree | f90e7e01a37d073aa678f3c37a4a67dc4ba40523 | |
parent | f139242382c8ba330d13a93bd75bbef5c06824e3 (diff) | |
download | aspectj-b3be9410fcd333a516e6a220d30f9705b7aa9748.tar.gz aspectj-b3be9410fcd333a516e6a220d30f9705b7aa9748.zip |
hopefully the last word on parameterizing pointcuts in all their various glorious flavours
3 files changed, 21 insertions, 3 deletions
diff --git a/weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java b/weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java index cf3d5967d..4335957e1 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java +++ b/weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java @@ -147,8 +147,8 @@ public class ResolvedPointcutDefinition extends ResolvedMemberImpl { ret.setSourceContext(getSourceContext()); ret.setPosition(getStart(),getEnd()); ret.setParameterNames(getParameterNames()); - //return ret; - return this; + return ret; + //return this; } // for testing diff --git a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java index 2f2c965a4..f20223cb4 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java @@ -194,6 +194,7 @@ public class ReferencePointcut extends Pointcut { return; } + //if (onType == null) onType = pointcutDef.getDeclaringType(); if (onType != null) { if (onType.isParameterizedType()) { // build a type map mapping type variable names in the generic type to diff --git a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java index d3e4cfff3..8313460bd 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java @@ -18,6 +18,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.StringTokenizer; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.Message; @@ -532,8 +533,24 @@ public class WildTypePattern extends TypePattern { } public TypePattern parameterizeWith(Map typeVariableMap) { + NamePattern[] newNamePatterns = new NamePattern[namePatterns.length]; + for(int i=0; i<namePatterns.length;i++) { newNamePatterns[i] = namePatterns[i]; } + if (newNamePatterns.length == 1) { + String simpleName = newNamePatterns[0].maybeGetSimpleName(); + if (simpleName != null) { + if (typeVariableMap.containsKey(simpleName)) { + String newName = ((ReferenceType)typeVariableMap.get(simpleName)).getName().replace('$','.'); + StringTokenizer strTok = new StringTokenizer(newName,"."); + newNamePatterns = new NamePattern[strTok.countTokens()]; + int index = 0; + while(strTok.hasMoreTokens()) { + newNamePatterns[index++] = new NamePattern(strTok.nextToken()); + } + } + } + } WildTypePattern ret = new WildTypePattern( - namePatterns, + newNamePatterns, includeSubtypes, dim, isVarArgs, |