]> source.dussan.org Git - aspectj.git/commitdiff
slowly merging in optimizations
authoraclement <aclement>
Sat, 7 Nov 2009 23:51:18 +0000 (23:51 +0000)
committeraclement <aclement>
Sat, 7 Nov 2009 23:51:18 +0000 (23:51 +0000)
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/HasMemberTypePattern.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/IfPointcut.java

index 0f919a3805a6443964abb6dad6f6a57faacd4ec2..fbf2f8464eca6bbf49c964de9811a83c76b4a6ce 100644 (file)
@@ -211,8 +211,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
         * @param wantGenerics is true if the caller would like all generics information, otherwise those methods are collapsed to their
         *        erasure
         */
-       public Iterator<ResolvedMember> getMethods(boolean wantGenerics) {
-               return Iterators.mapOver(getHierarchy(wantGenerics, false), MethodGetterInstance);
+       public Iterator<ResolvedMember> getMethods(boolean wantGenerics, boolean wantDeclaredParents) {
+               return Iterators.mapOver(getHierarchy(wantGenerics, wantDeclaredParents), MethodGetterInstance);
        }
 
        public Iterator<ResolvedMember> getMethodsIncludingIntertypeDeclarations(boolean wantGenerics) {
@@ -353,50 +353,6 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
                }
        }
 
-       /**
-        * 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
-        * <p/>
-        * <ul>
-        * <li>methods from current class</li>
-        * <li>recur into superclass, all the way up, not touching interfaces</li>
-        * <li>recur into all superinterfaces, in some unspecified order</li>
-        * </ul>
-        * <p/>
-        * We keep a hashSet of interfaces that we've visited so we don't spiral out into 2^n land. NOTE: Take a look at the javadoc on
-        * getMethodsWithoutIterator() to see if you are sensitive to a quirk in getMethods()
-        */
-       public Iterator<ResolvedMember> getMethods() {
-               final Iterators.Filter<ResolvedType> dupFilter = Iterators.dupFilter();
-               Iterators.Getter<ResolvedType, ResolvedType> ifaceGetter = new Iterators.Getter<ResolvedType, ResolvedType>() {
-                       public Iterator<ResolvedType> get(ResolvedType o) {
-                               return dupFilter.filter(Iterators.array(o.getDeclaredInterfaces()));
-                       }
-               };
-               Iterators.Getter<ResolvedType, ResolvedMember> methodGetter = new Iterators.Getter<ResolvedType, ResolvedMember>() {
-                       public Iterator<ResolvedMember> get(ResolvedType o) {
-                               return Iterators.array((o).getDeclaredMethods());
-                       }
-               };
-               return Iterators.mapOver(Iterators.append(new Iterator<ResolvedType>() {
-                       ResolvedType curr = ResolvedType.this;
-
-                       public boolean hasNext() {
-                               return curr != null;
-                       }
-
-                       public ResolvedType next() {
-                               ResolvedType ret = curr;
-                               curr = curr.getSuperclass();
-                               return ret;
-                       }
-
-                       public void remove() {
-                               throw new UnsupportedOperationException();
-                       }
-               }, Iterators.recur(this, ifaceGetter)), methodGetter);
-       }
-
        /**
         * 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!
@@ -1454,7 +1410,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
                                continue;
                        }
 
-                       for (Iterator<ResolvedMember> iter = getMethods(); iter.hasNext();) {
+                       for (Iterator<ResolvedMember> iter = getMethods(true, true); iter.hasNext();) {
                                ResolvedMember method = iter.next();
                                if (conflictingSignature(method, superMunger.getSignature())) {
                                        iter1.remove();
index 3f8a01e6957cfb97ef7470e27cbe7f1c77810ec2..261a01c4a84b370a49b79242487fb2ae2a08185a 100644 (file)
@@ -326,7 +326,7 @@ public class DeclareAnnotation extends Declare {
                if (annotation != null) {
                        return;
                }
-               for (Iterator iter = containingAspect.getMethods(); iter.hasNext();) {
+               for (Iterator iter = containingAspect.getMethods(true, true); iter.hasNext();) {
                        ResolvedMember member = (ResolvedMember) iter.next();
                        if (member.getName().equals(annotationMethod)) {
                                AnnotationAJ[] annos = member.getAnnotations();
@@ -388,7 +388,7 @@ public class DeclareAnnotation extends Declare {
         */
        public ResolvedType getAnnotationType() {
                if (annotationType == null) {
-                       for (Iterator iter = containingAspect.getMethods(); iter.hasNext();) {
+                       for (Iterator iter = containingAspect.getMethods(true, true); iter.hasNext();) {
                                ResolvedMember member = (ResolvedMember) iter.next();
                                if (member.getName().equals(annotationMethod)) {
                                        ResolvedType[] annoTypes = member.getAnnotationTypes();
index 8a202d71bfc55cacd46d000a4d95792872aa2589..3cfc62c7bea312e88a45bab0dabdd9003ea9589e 100644 (file)
@@ -75,7 +75,7 @@ public class HasMemberTypePattern extends TypePattern {
        private boolean hasMethod(ResolvedType type) {
                // TODO what about ITDs
                World world = type.getWorld();
-               for (Iterator iter = type.getMethods(); iter.hasNext();) {
+               for (Iterator iter = type.getMethods(true, true); iter.hasNext();) {
                        Member method = (Member) iter.next();
                        if (method.getName().startsWith(declareAtPrefix)) {
                                continue;
index f2cddbb90daf93794bfb2b7ae56b8127b59bfb69..c0e0f2b206cb22bda39cbaded29513a8d817d3cc 100644 (file)
@@ -345,7 +345,7 @@ public class IfPointcut extends Pointcut {
                        ResolvedPointcutDefinition def = bindings.peekEnclosingDefinition();
                        if (def != null) {
                                ResolvedType aspect = inAspect.getWorld().resolve(def.getDeclaringType());
-                               for (Iterator memberIter = aspect.getMethods(); memberIter.hasNext();) {
+                               for (Iterator memberIter = aspect.getMethods(true, true); memberIter.hasNext();) {
                                        ResolvedMember method = (ResolvedMember) memberIter.next();
                                        if (def.getName().equals(method.getName())
                                                        && def.getParameterTypes().length == method.getParameterTypes().length) {