diff options
author | acolyer <acolyer> | 2005-07-20 16:17:52 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-07-20 16:17:52 +0000 |
commit | 58bab9062a9cb2a3883ab49c16e800bb80c612f1 (patch) | |
tree | face61d5c2a22b3e8212cc0986d86977b2f051c6 | |
parent | d027d6eb67b47cfb2ea8ba88bcf841b7d756bc27 (diff) | |
download | aspectj-58bab9062a9cb2a3883ab49c16e800bb80c612f1.tar.gz aspectj-58bab9062a9cb2a3883ab49c16e800bb80c612f1.zip |
handle superinterfaces correctly for raw types
-rw-r--r-- | weaver/src/org/aspectj/weaver/ReferenceType.java | 33 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/ResolvedType.java | 4 |
2 files changed, 31 insertions, 6 deletions
diff --git a/weaver/src/org/aspectj/weaver/ReferenceType.java b/weaver/src/org/aspectj/weaver/ReferenceType.java index f62d4f1ed..84dbb9865 100644 --- a/weaver/src/org/aspectj/weaver/ReferenceType.java +++ b/weaver/src/org/aspectj/weaver/ReferenceType.java @@ -200,16 +200,34 @@ public class ReferenceType extends ResolvedType { */ public ResolvedType[] getDeclaredInterfaces() { if (parameterizedInterfaces != null) return parameterizedInterfaces; - if (isParameterizedType() || isRawType()) { + if (isParameterizedType()) { ResolvedType[] delegateInterfaces = delegate.getDeclaredInterfaces(); + UnresolvedType[] paramTypes = getTypesForMemberParameterization(); parameterizedInterfaces = new ResolvedType[delegateInterfaces.length]; for (int i = 0; i < delegateInterfaces.length; i++) { - parameterizedInterfaces[i] = delegateInterfaces[i].parameterizedWith(getTypesForMemberParameterization()); + parameterizedInterfaces[i] = delegateInterfaces[i].parameterizedWith(paramTypes); } return parameterizedInterfaces; - } else { - return delegate.getDeclaredInterfaces(); - } + } else if (isRawType()){ + ResolvedType[] delegateInterfaces = delegate.getDeclaredInterfaces(); + UnresolvedType[] paramTypes = getTypesForMemberParameterization(); + parameterizedInterfaces = new ResolvedType[delegateInterfaces.length]; + for (int i = 0; i < parameterizedInterfaces.length; i++) { + parameterizedInterfaces[i] = delegateInterfaces[i]; + if (parameterizedInterfaces[i].isGenericType()) { + // a generic supertype of a raw type is replaced by its raw equivalent + parameterizedInterfaces[i] = + parameterizedInterfaces[i].getRawType().resolve(getWorld()); + } else if (parameterizedInterfaces[i].isParameterizedType()) { + // a parameterized supertype collapses any type vars to their upper + // bounds + parameterizedInterfaces[i] = + parameterizedInterfaces[i].parameterizedWith(paramTypes); + } + } + return parameterizedInterfaces; + } + return delegate.getDeclaredInterfaces(); } public ResolvedMember[] getDeclaredMethods() { @@ -256,6 +274,10 @@ public class ReferenceType extends ResolvedType { return parameters; } + public UnresolvedType getRawType() { + return super.getRawType().resolve(getWorld()); + } + public TypeVariable[] getTypeVariables() { return delegate.getTypeVariables(); } @@ -331,6 +353,7 @@ public class ReferenceType extends ResolvedType { } public ResolvedType getGenericType() { + if (isGenericType()) return this; return genericType; } diff --git a/weaver/src/org/aspectj/weaver/ResolvedType.java b/weaver/src/org/aspectj/weaver/ResolvedType.java index 045377922..f6fc35210 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedType.java +++ b/weaver/src/org/aspectj/weaver/ResolvedType.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -1406,7 +1407,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } public ResolvedType parameterizedWith(UnresolvedType[] typeParameters) { - return this; + if (!(isGenericType() || isParameterizedType())) return this; + return TypeFactory.createParameterizedType(this.getGenericType(), typeParameters, getWorld()); } /** |