aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-07-29 11:11:29 +0000
committeracolyer <acolyer>2005-07-29 11:11:29 +0000
commit65e1b7ce15ceae73abf8cb928e2091d0087334a0 (patch)
treebb330d6e2dcfc871ed73b5c906e6c610e19f22ed
parent1156a21f2a2e1b15930f4691ef8946e3ab22f205 (diff)
downloadaspectj-65e1b7ce15ceae73abf8cb928e2091d0087334a0.tar.gz
aspectj-65e1b7ce15ceae73abf8cb928e2091d0087334a0.zip
fixes paramerization for raw types so that List<T> goes to List and not List<Object>
-rw-r--r--weaver/src/org/aspectj/weaver/ReferenceType.java7
-rw-r--r--weaver/src/org/aspectj/weaver/ResolvedMember.java18
2 files changed, 16 insertions, 9 deletions
diff --git a/weaver/src/org/aspectj/weaver/ReferenceType.java b/weaver/src/org/aspectj/weaver/ReferenceType.java
index 8ff58c35a..fc2069a1a 100644
--- a/weaver/src/org/aspectj/weaver/ReferenceType.java
+++ b/weaver/src/org/aspectj/weaver/ReferenceType.java
@@ -204,7 +204,8 @@ public class ReferenceType extends ResolvedType {
ResolvedMember[] delegateFields = delegate.getDeclaredFields();
parameterizedFields = new ResolvedMember[delegateFields.length];
for (int i = 0; i < delegateFields.length; i++) {
- parameterizedFields[i] = delegateFields[i].parameterizedWith(getTypesForMemberParameterization(),this);
+ parameterizedFields[i] =
+ delegateFields[i].parameterizedWith(getTypesForMemberParameterization(),this, isParameterizedType());
}
return parameterizedFields;
} else {
@@ -256,7 +257,7 @@ public class ReferenceType extends ResolvedType {
UnresolvedType[] parameters = getTypesForMemberParameterization();
parameterizedMethods = new ResolvedMember[delegateMethods.length];
for (int i = 0; i < delegateMethods.length; i++) {
- parameterizedMethods[i] = delegateMethods[i].parameterizedWith(parameters,this);
+ parameterizedMethods[i] = delegateMethods[i].parameterizedWith(parameters,this,isRawType());
}
return parameterizedMethods;
} else {
@@ -270,7 +271,7 @@ public class ReferenceType extends ResolvedType {
ResolvedMember[] delegatePointcuts = delegate.getDeclaredPointcuts();
parameterizedPointcuts = new ResolvedMember[delegatePointcuts.length];
for (int i = 0; i < delegatePointcuts.length; i++) {
- parameterizedPointcuts[i] = delegatePointcuts[i].parameterizedWith(getTypesForMemberParameterization(),this);
+ parameterizedPointcuts[i] = delegatePointcuts[i].parameterizedWith(getTypesForMemberParameterization(),this,isRawType());
}
return parameterizedPointcuts;
} else {
diff --git a/weaver/src/org/aspectj/weaver/ResolvedMember.java b/weaver/src/org/aspectj/weaver/ResolvedMember.java
index 777e8a7c0..15b8252ad 100644
--- a/weaver/src/org/aspectj/weaver/ResolvedMember.java
+++ b/weaver/src/org/aspectj/weaver/ResolvedMember.java
@@ -13,7 +13,6 @@
package org.aspectj.weaver;
-import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Modifier;
@@ -360,7 +359,10 @@ public class ResolvedMember extends Member implements IHasPosition, AnnotatedEle
// return a resolved member in which all type variables in the signature of this
// member have been replaced with the given bindings.
- public ResolvedMember parameterizedWith(UnresolvedType[] typeParameters,ResolvedType newDeclaringType) {
+ // the isParameterized flag tells us whether we are creating a raw type version or not
+ // if isParameterized List<T> will turn into List<String> (for example),
+ // but if !isParameterized List<T> will turn into List.
+ public ResolvedMember parameterizedWith(UnresolvedType[] typeParameters,ResolvedType newDeclaringType, boolean isParameterized) {
if (!this.getDeclaringType().isGenericType()) {
throw new IllegalStateException("Can't ask to parameterize a member of a non-generic type");
}
@@ -372,11 +374,11 @@ public class ResolvedMember extends Member implements IHasPosition, AnnotatedEle
for (int i = 0; i < typeVariables.length; i++) {
typeMap.put(typeVariables[i].getName(), typeParameters[i]);
}
- UnresolvedType parameterizedReturnType = parameterize(getGenericReturnType(),typeMap);
+ UnresolvedType parameterizedReturnType = parameterize(getGenericReturnType(),typeMap,isParameterized);
UnresolvedType[] parameterizedParameterTypes = new UnresolvedType[getGenericParameterTypes().length];
for (int i = 0; i < parameterizedParameterTypes.length; i++) {
parameterizedParameterTypes[i] =
- parameterize(getGenericParameterTypes()[i], typeMap);
+ parameterize(getGenericParameterTypes()[i], typeMap,isParameterized);
}
return new ResolvedMember(
getKind(),
@@ -399,7 +401,7 @@ public class ResolvedMember extends Member implements IHasPosition, AnnotatedEle
return typeVariables;
}
- private UnresolvedType parameterize(UnresolvedType aType, Map typeVariableMap) {
+ private UnresolvedType parameterize(UnresolvedType aType, Map typeVariableMap, boolean inParameterizedType) {
if (aType instanceof TypeVariableReferenceType) {
String variableName = ((TypeVariableReferenceType)aType).getTypeVariable().getName();
if (!typeVariableMap.containsKey(variableName)) {
@@ -407,7 +409,11 @@ public class ResolvedMember extends Member implements IHasPosition, AnnotatedEle
}
return (UnresolvedType) typeVariableMap.get(variableName);
} else if (aType.isParameterizedType()) {
- return aType.parameterize(typeVariableMap);
+ if (inParameterizedType) {
+ return aType.parameterize(typeVariableMap);
+ } else {
+ return aType.getRawType();
+ }
}
return aType;
}