diff options
author | acolyer <acolyer> | 2005-08-18 09:34:00 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-08-18 09:34:00 +0000 |
commit | dde3a9141c63bd2911896735855625cd50803040 (patch) | |
tree | 66524d30258cf14567c4fef596ec0453b9bf80c7 /weaver | |
parent | 867a65660c1d55f7e548c9f0957daa1241f96164 (diff) | |
download | aspectj-dde3a9141c63bd2911896735855625cd50803040.tar.gz aspectj-dde3a9141c63bd2911896735855625cd50803040.zip |
implementation of parameterizeWith and fix for 107059 part 2
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java index 2f83084b5..3f6a2cc6f 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java @@ -17,6 +17,7 @@ import java.io.DataOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Map; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.Message; @@ -455,7 +456,7 @@ public class WildTypePattern extends TypePattern { } public NamePattern extractName() { - if (isIncludeSubtypes() || isVarArgs() || isArray()) { + if (isIncludeSubtypes() || isVarArgs() || isArray() || (typeParameters.size() > 0)) { // we can't extract a name, the pattern is something like Foo+ and therefore // it is not ok to treat Foo as a method name! return null; @@ -520,6 +521,27 @@ public class WildTypePattern extends TypePattern { return buf.toString(); } + public TypePattern parameterizeWith(Map typeVariableMap) { + WildTypePattern ret = new WildTypePattern( + namePatterns, + includeSubtypes, + dim, + isVarArgs, + typeParameters.parameterizeWith(typeVariableMap) + ); + ret.annotationPattern = this.annotationPattern.parameterizeWith(typeVariableMap); + ret.additionalInterfaceBounds = new TypePattern[additionalInterfaceBounds.length]; + for (int i = 0; i < additionalInterfaceBounds.length; i++) { + ret.additionalInterfaceBounds[i] = additionalInterfaceBounds[i].parameterizeWith(typeVariableMap); + } + ret.upperBound = upperBound.parameterizeWith(typeVariableMap); + ret.lowerBound = lowerBound.parameterizeWith(typeVariableMap); + ret.isGeneric = isGeneric; + ret.knownMatches = knownMatches; + ret.importedPrefixes = importedPrefixes; + ret.copyLocationFrom(this); + return ret; + } /** * Need to determine if I'm really a pattern or a reference to a formal @@ -533,7 +555,16 @@ public class WildTypePattern extends TypePattern { { if (isNamePatternStar()) { TypePattern anyPattern = maybeResolveToAnyPattern(scope, bindings, allowBinding, requireExactType); - if (anyPattern != null) return anyPattern; + if (anyPattern != null) { + if (requireExactType) { + scope.getWorld().getMessageHandler().handleMessage( + MessageUtil.error(WeaverMessages.format(WeaverMessages.WILDCARD_NOT_ALLOWED), + getSourceLocation())); + return NO; + } else { + return anyPattern; + } + } } TypePattern bindingTypePattern = maybeResolveToBindingTypePattern(scope, bindings, allowBinding, requireExactType); |