summaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2002-12-18 01:37:07 +0000
committerjhugunin <jhugunin>2002-12-18 01:37:07 +0000
commitbf459dfaf201caeaf3e099408a11e08cd542c752 (patch)
treedeb493a88b0a488428c4e44d59a82a3611c73864 /weaver
parent96db4fbc4c83aac5411e25199ea237584b836036 (diff)
downloadaspectj-bf459dfaf201caeaf3e099408a11e08cd542c752.tar.gz
aspectj-bf459dfaf201caeaf3e099408a11e08cd542c752.zip
wildcarded type patterns now remember there scope information
so they can do matching of local names
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java
index 90f8c31b7..c12c0e8dc 100644
--- a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java
+++ b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java
@@ -21,6 +21,8 @@ import org.aspectj.bridge.*;
import org.aspectj.bridge.IMessage;
import org.aspectj.util.*;
+import com.sun.corba.se.internal.util.Utility;
+
//XXX need to use dim in matching
public class WildTypePattern extends TypePattern {
NamePattern[] namePatterns;
@@ -74,8 +76,10 @@ public class WildTypePattern extends TypePattern {
protected boolean matchesExactly(ResolvedTypeX type) {
String targetTypeName = type.getName();
+ //System.err.println("match: " + targetTypeName + ", " + knownMatches); //Arrays.asList(importedPrefixes));
+
//XXX hack
- if (knownMatches == null) {
+ if (knownMatches == null && importedPrefixes == null) {
return innerMatchesExactly(targetTypeName);
}
@@ -102,7 +106,9 @@ public class WildTypePattern extends TypePattern {
// assumes that prefixes have a dot at the end
for (int i=0, len=importedPrefixes.length; i < len; i++) {
String prefix = importedPrefixes[i];
+ //System.err.println("prefix match? " + prefix + " to " + targetTypeName);
if (targetTypeName.startsWith(prefix)) {
+
if (innerMatchesExactly(targetTypeName.substring(prefix.length()))) {
return true;
}
@@ -123,8 +129,6 @@ public class WildTypePattern extends TypePattern {
//??? doing this everytime is not very efficient
char[][] names = splitNames(targetTypeName);
-
-
return innerMatchesExactly(names);
}
@@ -427,6 +431,10 @@ public class WildTypePattern extends TypePattern {
}
s.writeBoolean(includeSubtypes);
s.writeInt(dim);
+ //??? storing this information with every type pattern is wasteful of .class
+ // file size. Storing it on enclosing types would be more efficient
+ FileUtil.writeStringArray(s, knownMatches);
+ FileUtil.writeStringArray(s, importedPrefixes);
writeLocation(s);
}
@@ -438,7 +446,9 @@ public class WildTypePattern extends TypePattern {
}
boolean includeSubtypes = s.readBoolean();
int dim = s.readInt();
- TypePattern ret = new WildTypePattern(namePatterns, includeSubtypes, dim);
+ WildTypePattern ret = new WildTypePattern(namePatterns, includeSubtypes, dim);
+ ret.knownMatches = FileUtil.readStringArray(s);
+ ret.importedPrefixes = FileUtil.readStringArray(s);
ret.readLocation(context, s);
return ret;
}