From: aclement Date: Fri, 11 Dec 2009 18:48:27 +0000 (+0000) Subject: minor optimizations, but in code that is run 1000000s of times X-Git-Tag: V1_6_7~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8310b6ae94cd26c367e4750cd7f72d5542d8a80e;p=aspectj.git minor optimizations, but in code that is run 1000000s of times --- diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java index 10ffc7fc2..7990566f2 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java @@ -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; } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java index 8675423bd..4672f7bd7 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java @@ -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; }