From 6ecb02bddcd254d8d927bf44aae6614f5bd89049 Mon Sep 17 00:00:00 2001 From: aclement Date: Sat, 7 Nov 2009 22:20:46 +0000 Subject: [PATCH] slowly merging in optimizations --- .../src/org/aspectj/weaver/ResolvedType.java | 71 +++++++++---------- .../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 { - - 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 getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing) { - List methods = new ArrayList(); - Set knowninterfaces = new HashSet(); - addAndRecurse(knowninterfaces, methods, this, includeITDs, allowMissing, false); - return methods; - } - public List getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) { List methods = new ArrayList(); Set knowninterfaces = new HashSet(); @@ -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 { + + 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 { private Getter 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 incorrectTargets = new ArrayList(); 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 */ -- 2.39.5