From 452374ba5120a8c829e64460b518137d627a6eaf Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 12 May 2008 01:46:18 +0000 Subject: [PATCH] 231478: testcode and fix - allow for bounds variation when sub-aspect is parameterizing super-aspect --- weaver/src/org/aspectj/weaver/TypeVariable.java | 16 +++++++++++++++- .../UnresolvedTypeVariableReferenceType.java | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/weaver/src/org/aspectj/weaver/TypeVariable.java b/weaver/src/org/aspectj/weaver/TypeVariable.java index d85d7412d..d5045ecd8 100644 --- a/weaver/src/org/aspectj/weaver/TypeVariable.java +++ b/weaver/src/org/aspectj/weaver/TypeVariable.java @@ -215,7 +215,20 @@ public class TypeVariable { // can match any type in the range of the type variable... // XXX what about interfaces? private boolean matchingBounds(TypeVariableReferenceType tvrt) { - if (tvrt.getUpperBound() != getUpperBound()) return false; + if (tvrt.getUpperBound() != getUpperBound()) { + UnresolvedType unresolvedCandidateUpperBound = tvrt.getUpperBound(); + UnresolvedType unresolvedThisUpperBound = getUpperBound(); + if (unresolvedCandidateUpperBound instanceof ResolvedType && unresolvedThisUpperBound instanceof ResolvedType) { + ResolvedType candidateUpperBound = (ResolvedType)unresolvedCandidateUpperBound; + ResolvedType thisUpperBound = (ResolvedType)unresolvedThisUpperBound; + if (!thisUpperBound.isAssignableFrom(candidateUpperBound)) { + return false; + } + } else { + // not right, they shouldnt have been unresolved... + return false; + } + } if (tvrt.hasLowerBound() != (getLowerBound() != null)) return false; if (tvrt.hasLowerBound() && tvrt.getLowerBound() != getLowerBound()) return false; // either we both have bounds, or neither of us have bounds @@ -379,6 +392,7 @@ public class TypeVariable { public String getGenericSignature() { return "T"+name+";"; +// return "T"+getSignature(); } public String getErasureSignature() { return getFirstBound().getErasureSignature(); diff --git a/weaver/src/org/aspectj/weaver/UnresolvedTypeVariableReferenceType.java b/weaver/src/org/aspectj/weaver/UnresolvedTypeVariableReferenceType.java index d398a97af..d6486b532 100644 --- a/weaver/src/org/aspectj/weaver/UnresolvedTypeVariableReferenceType.java +++ b/weaver/src/org/aspectj/weaver/UnresolvedTypeVariableReferenceType.java @@ -37,6 +37,7 @@ public class UnresolvedTypeVariableReferenceType extends UnresolvedType implemen public void setTypeVariable(TypeVariable aTypeVariable) { this.signature = "T" + aTypeVariable.getName() + ";"; //aTypeVariable.getUpperBound().getSignature(); this.typeVariable = aTypeVariable; + this.typeKind=TypeKind.TYPE_VARIABLE; } public ResolvedType resolve(World world) { -- 2.39.5