aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2009-12-11 18:48:27 +0000
committeraclement <aclement>2009-12-11 18:48:27 +0000
commit8310b6ae94cd26c367e4750cd7f72d5542d8a80e (patch)
treef9be4ff14325015db36ebb5e776426208086c9d0
parent2f890d2be9d868875755c0487b494ca7483463a2 (diff)
downloadaspectj-8310b6ae94cd26c367e4750cd7f72d5542d8a80e.tar.gz
aspectj-8310b6ae94cd26c367e4750cd7f72d5542d8a80e.zip
minor optimizations, but in code that is run 1000000s of times
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java9
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java21
2 files changed, 16 insertions, 14 deletions
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;
}