diff options
author | aclement <aclement> | 2009-11-07 22:20:46 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-11-07 22:20:46 +0000 |
commit | 6ecb02bddcd254d8d927bf44aae6614f5bd89049 (patch) | |
tree | 67d5c73d9e895fe9de72c4d0d82979974a9141a4 | |
parent | d80b8aa5a339d331c39cc84635187555ce2dcd86 (diff) | |
download | aspectj-6ecb02bddcd254d8d927bf44aae6614f5bd89049.tar.gz aspectj-6ecb02bddcd254d8d927bf44aae6614f5bd89049.zip |
slowly merging in optimizations
-rw-r--r-- | org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java | 71 | ||||
-rw-r--r-- | org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java | 6 |
2 files changed, 37 insertions, 40 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java index b86c11d78..0f919a380 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java @@ -353,37 +353,6 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } } - public static class SuperClassWalker implements Iterator<ResolvedType> { - - private ResolvedType curr; - private SuperInterfaceWalker iwalker; - private boolean wantGenerics; - - public SuperClassWalker(ResolvedType type, SuperInterfaceWalker iwalker, boolean genericsAware) { - this.curr = type; - this.iwalker = iwalker; - this.wantGenerics = genericsAware; - } - - public boolean hasNext() { - return curr != null; - } - - public ResolvedType next() { - ResolvedType ret = curr; - if (!wantGenerics && ret.isParameterizedOrGenericType()) { - ret = ret.getRawType(); - } - iwalker.push(ret); // tell the interface walker about another class whose interfaces need visiting - curr = curr.getSuperclass(); - return ret; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - } - /** * returns an iterator through all of the methods of this type, in order for checking from JVM spec 2ed 5.4.3.3. This means that * the order is @@ -432,13 +401,6 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * Return a list of methods, first those declared on this class, then those declared on the superclass (recurse) and then those * declared on the superinterfaces. This is expensive - use the getMethods() method if you can! */ - public List<ResolvedMember> getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing) { - List<ResolvedMember> methods = new ArrayList<ResolvedMember>(); - Set<String> knowninterfaces = new HashSet<String>(); - addAndRecurse(knowninterfaces, methods, this, includeITDs, allowMissing, false); - return methods; - } - public List<ResolvedMember> getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) { List<ResolvedMember> methods = new ArrayList<ResolvedMember>(); Set<String> knowninterfaces = new HashSet<String>(); @@ -1770,7 +1732,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl sig = munger.getSignature(); // possibly changed when type parms filled in if (sig.getKind() == Member.METHOD) { - if (clashesWithExistingMember(munger, getMethodsWithoutIterator(false, true).iterator())) { + if (clashesWithExistingMember(munger, getMethodsWithoutIterator(false, true, false).iterator())) { return; } if (this.isInterface()) { @@ -2186,6 +2148,37 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return null; } + static class SuperClassWalker implements Iterator<ResolvedType> { + + private ResolvedType curr; + private SuperInterfaceWalker iwalker; + private boolean wantGenerics; + + public SuperClassWalker(ResolvedType type, SuperInterfaceWalker iwalker, boolean genericsAware) { + this.curr = type; + this.iwalker = iwalker; + this.wantGenerics = genericsAware; + } + + public boolean hasNext() { + return curr != null; + } + + public ResolvedType next() { + ResolvedType ret = curr; + if (!wantGenerics && ret.isParameterizedOrGenericType()) { + ret = ret.getRawType(); + } + iwalker.push(ret); // tell the interface walker about another class whose interfaces need visiting + curr = curr.getSuperclass(); + return ret; + } + + public void remove() { + throw new UnsupportedOperationException(); + } + } + static class SuperInterfaceWalker implements Iterator<ResolvedType> { private Getter<ResolvedType, ResolvedType> ifaceGetter; diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java index 06934d563..51251d9b7 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java @@ -200,7 +200,7 @@ public class SignaturePattern extends PatternNode { if (targetKinds == null) { return data; } - List incorrectTargets = new ArrayList(); + List<AnnotationTargetKind> incorrectTargets = new ArrayList<AnnotationTargetKind>(); for (int i = 0; i < targetKinds.length; i++) { if (targetKinds[i].getName().equals(kind.getName()) || (targetKinds[i].getName().equals("PARAMETER") && node.isForParameterAnnotationMatch())) { @@ -467,6 +467,10 @@ public class SignaturePattern extends PatternNode { return FuzzyBoolean.YES; } + private ResolvedType[] getResolvedParameters(World world, UnresolvedType[] unresolvedParams) { + return world.resolve(unresolvedParams); + } + /** * match on declaring type, parameter types, throws types */ |