diff options
author | aclement <aclement> | 2006-10-03 15:00:34 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-10-03 15:00:34 +0000 |
commit | 782ade25e6d68caf361f51a1e040edbd6855842b (patch) | |
tree | 0ff9aff34b8d7757ad238fc84a32bf753a759786 /weaver | |
parent | 7b831ff7356725b9872a9635d1e0eeb035f2790b (diff) | |
download | aspectj-782ade25e6d68caf361f51a1e040edbd6855842b.tar.gz aspectj-782ade25e6d68caf361f51a1e040edbd6855842b.zip |
test and fix for 156904: missing type warning then it matches anyway
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java index 8eb3cdf2c..48f429274 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java @@ -687,7 +687,8 @@ public class WildTypePattern extends TypePattern { //System.out.println("resolve: " + cleanName); //??? this loop has too many inefficiencies to count - resolvedTypeInTheWorld = lookupTypeInWorld(scope.getWorld(), fullyQualifiedName); + resolvedTypeInTheWorld = lookupTypeInWorldIncludingPrefixes(scope.getWorld(), fullyQualifiedName, scope.getImportedPrefixes()); + if (resolvedTypeInTheWorld.isGenericWildcard()) { type = resolvedTypeInTheWorld; } else { @@ -712,6 +713,27 @@ public class WildTypePattern extends TypePattern { return type; } + /** + * Searches the world for the ResolvedType with the given typeName. If one + * isn't found then for each of the supplied prefixes, it prepends the typeName + * with the prefix and searches the world for the ResolvedType with this new name. + * If one still isn't found then a MissingResolvedTypeWithKnownSignature is + * returned with the originally requested typeName (this ensures the typeName + * makes sense). + */ + private ResolvedType lookupTypeInWorldIncludingPrefixes(World world, String typeName, String[] prefixes) { + ResolvedType ret = lookupTypeInWorld(world, typeName); + if (!ret.isMissing()) return ret; + ResolvedType retWithPrefix = ret; + int counter = 0; + while (retWithPrefix.isMissing() && (counter < prefixes.length)) { + retWithPrefix = lookupTypeInWorld(world,prefixes[counter] + typeName); + counter++; + } + if (!retWithPrefix.isMissing()) return retWithPrefix; + return ret; + } + private ResolvedType lookupTypeInWorld(World world, String typeName) { ResolvedType ret = world.resolve(UnresolvedType.forName(typeName),true); while (ret.isMissing()) { |