]> source.dussan.org Git - aspectj.git/commitdiff
slowly merging in optimizations
authoraclement <aclement>
Sat, 7 Nov 2009 22:20:46 +0000 (22:20 +0000)
committeraclement <aclement>
Sat, 7 Nov 2009 22:20:46 +0000 (22:20 +0000)
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/SignaturePattern.java

index b86c11d78a49ef3c445117912b1d29190e541fdb..0f919a3805a6443964abb6dad6f6a57faacd4ec2 100644 (file)
@@ -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;
index 06934d563527c067dc7cb56e49d2ed810823afbb..51251d9b746ff61007355caab8d4c27090ff3cf2 100644 (file)
@@ -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
         */