]> source.dussan.org Git - aspectj.git/commitdiff
minor optimizations, but in code that is run 1000000s of times
authoraclement <aclement>
Fri, 11 Dec 2009 18:48:27 +0000 (18:48 +0000)
committeraclement <aclement>
Fri, 11 Dec 2009 18:48:27 +0000 (18:48 +0000)
org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java

index 10ffc7fc26f8e68e4974ce8a648c6e239fad2d7b..7990566f2e221231dc21092e6c21dd8ea7154b74 100644 (file)
@@ -415,17 +415,20 @@ public class ReferenceType extends ResolvedType {
                        return true;
                }
 
-               if ((this.isRawType() || this.isGenericType()) && other.isParameterizedType()) {
+               boolean thisRaw = this.isRawType();
+               boolean thisGeneric = this.isGenericType();
+               
+               if ((thisRaw || thisGeneric) && other.isParameterizedType()) {
                        if (isAssignableFrom(other.getRawType())) {
                                return true;
                        }
                }
-               if (this.isRawType() && other.isGenericType()) {
+               if (thisRaw && other.isGenericType()) {
                        if (isAssignableFrom(other.getRawType())) {
                                return true;
                        }
                }
-               if (this.isGenericType() && other.isRawType()) {
+               if (thisGeneric && other.isRawType()) {
                        if (isAssignableFrom(other.getGenericType())) {
                                return true;
                        }
index 8675423bd39dc9cb00bfa1646bc4d6d7660354c8..4672f7bd7bc87d250fbf94abb4cd99a8dc47c088 100644 (file)
@@ -2181,8 +2181,9 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
                public ResolvedType next() {
                        ResolvedType next = delegate.next();
                        // BUG should check for generics and erase?
-                       if (!visited.contains(next)) {
-                               visited.add(next);
+//                     if (!visited.contains(next)) {
+//                             visited.add(next);
+                       if (visited.add(next)) {
                                toPersue.add(next); // pushes on interfaces already visited?
                        }
                        return next;
@@ -2208,17 +2209,15 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
                        b = false;
                } else if (!interfaceType.isAssignableFrom(this, true)) {
                        b = false;
-               } else
-               // check that I'm truly the topmost implementor
-               if (this.getSuperclass().isMissing()) {
-                       b = true; // we don't know anything about supertype, and it can't
-               } else
-               // be exposed to weaver
-               if (interfaceType.isAssignableFrom(this.getSuperclass(), true)) {
-                       b = false;
+               } else {
+                       ResolvedType superclass = this.getSuperclass();
+                       if (superclass.isMissing()) {
+                               b = true; // we don't know anything about supertype, and it can't be exposed to weaver
+                       } else if (interfaceType.isAssignableFrom(superclass, true)) { // check that I'm truly the topmost implementor
+                               b = false;
+                       }
                }
                // System.out.println("is " + getName() + " topmostimplementor of " + interfaceType + "? " + b);
-               // System.err.println("Was topmostimplementor? "+interfaceType.getName()+" "+b);
                return b;
        }