aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authoraclement <aclement>2010-04-16 21:15:36 +0000
committeraclement <aclement>2010-04-16 21:15:36 +0000
commita8f7c205c20ec089c13d8ee276731376af8aa2fe (patch)
treea84931a393ed86a86282d79f25b84e1a1869982d /org.aspectj.matcher
parenta4096978856a39dce1a1298d815509ddaad1b105 (diff)
downloadaspectj-a8f7c205c20ec089c13d8ee276731376af8aa2fe.tar.gz
aspectj-a8f7c205c20ec089c13d8ee276731376af8aa2fe.zip
309336: faster isAssignableFrom
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java58
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/UnresolvedType.java4
2 files changed, 31 insertions, 31 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java
index b876ad297..3d75c0bc3 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java
@@ -418,27 +418,22 @@ public class ReferenceType extends ResolvedType {
return true;
}
- if (this.getSignature().equals(ResolvedType.OBJECT.getSignature())) {
+ if (this.getSignature().equals("Ljava/lang/Object;")) {
return true;
}
- boolean thisRaw = this.isRawType();
- boolean thisGeneric = this.isGenericType();
-
- if ((thisRaw || thisGeneric) && other.isParameterizedType()) {
- if (isAssignableFrom(other.getRawType())) {
- return true;
- }
+ if (!isTypeVariableReference() && other.getSignature().equals("Ljava/lang/Object;")) {
+ return false;
}
- if (thisRaw && other.isGenericType()) {
- if (isAssignableFrom(other.getRawType())) {
- return true;
- }
+
+ boolean thisRaw = this.isRawType();
+ if (thisRaw && other.isParameterizedOrGenericType()) {
+ return isAssignableFrom(other.getRawType());
}
- if (thisGeneric && other.isRawType()) {
- if (isAssignableFrom(other.getGenericType())) {
- return true;
- }
+
+ boolean thisGeneric = this.isGenericType();
+ if (thisGeneric && other.isParameterizedOrRawType()) {
+ return isAssignableFrom(other.getGenericType());
}
if (this.isParameterizedType()) {
@@ -527,19 +522,8 @@ public class ReferenceType extends ResolvedType {
}
}
- if (isTypeVariableReference() && !other.isTypeVariableReference()) { // eg
- // .
- // this
- // =
- // T
- // other
- // =
- // Ljava
- // /
- // lang
- // /
- // Object
- // ;
+ // eg this=T other=Ljava/lang/Object;
+ if (isTypeVariableReference() && !other.isTypeVariableReference()) {
TypeVariable aVar = ((TypeVariableReference) this).getTypeVariable();
return aVar.resolve(world).canBeBoundTo(other);
}
@@ -564,13 +548,25 @@ public class ReferenceType extends ResolvedType {
ResolvedType[] interfaces = other.getDeclaredInterfaces();
for (ResolvedType intface : interfaces) {
- if (this.isAssignableFrom(intface, allowMissing)) {
+ boolean b;
+ if (thisRaw && intface.isParameterizedOrGenericType()) {
+ b = this.isAssignableFrom(intface.getRawType(), allowMissing);
+ } else {
+ b = this.isAssignableFrom(intface, allowMissing);
+ }
+ if (b) {
return true;
}
}
ResolvedType superclass = other.getSuperclass();
if (superclass != null) {
- if (this.isAssignableFrom(superclass, allowMissing)) {
+ boolean b;
+ if (thisRaw && superclass.isParameterizedOrGenericType()) {
+ b = this.isAssignableFrom(superclass.getRawType(), allowMissing);
+ } else {
+ b = this.isAssignableFrom(superclass, allowMissing);
+ }
+ if (b) {
return true;
}
}
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/UnresolvedType.java b/org.aspectj.matcher/src/org/aspectj/weaver/UnresolvedType.java
index 42e57ef24..8436c228e 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/UnresolvedType.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/UnresolvedType.java
@@ -177,6 +177,10 @@ public class UnresolvedType implements Traceable, TypeVariableDeclaringElement {
return typeKind == TypeKind.GENERIC || typeKind == TypeKind.PARAMETERIZED;
}
+ public boolean isParameterizedOrRawType() {
+ return typeKind == TypeKind.PARAMETERIZED || typeKind == TypeKind.RAW;
+ }
+
public boolean isTypeVariableReference() {
return typeKind == TypeKind.TYPE_VARIABLE;
}