diff options
author | aclement <aclement> | 2008-08-19 20:44:24 +0000 |
---|---|---|
committer | aclement <aclement> | 2008-08-19 20:44:24 +0000 |
commit | 61cfbc4afb972b2d4a4f9f0d982d94d54c447a40 (patch) | |
tree | d37ef79a5da7e566c67fa86b04b4a6e1464f2b25 /weaver | |
parent | 62e39dad3a12d338429c8dbbdbd0c072c352cef5 (diff) | |
download | aspectj-61cfbc4afb972b2d4a4f9f0d982d94d54c447a40.tar.gz aspectj-61cfbc4afb972b2d4a4f9f0d982d94d54c447a40.zip |
242797: crappy bounds checking in TypeVariable
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/TypeVariable.java | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/weaver/src/org/aspectj/weaver/TypeVariable.java b/weaver/src/org/aspectj/weaver/TypeVariable.java index 85a4a3303..344a71557 100644 --- a/weaver/src/org/aspectj/weaver/TypeVariable.java +++ b/weaver/src/org/aspectj/weaver/TypeVariable.java @@ -186,11 +186,6 @@ public class TypeVariable { public boolean canBeBoundTo(ResolvedType aCandidateType) { if (!isResolved) throw new IllegalStateException("Can't answer binding questions prior to resolving"); - // TODO 2 is this next bit bogus, what is it for? - if (aCandidateType.isTypeVariableReference()) { - return matchingBounds((TypeVariableReferenceType)aCandidateType); - } - // wildcard can accept any binding if (aCandidateType.isGenericWildcard()) { // AMC - need a more robust test! return true; @@ -214,50 +209,6 @@ public class TypeVariable { return true; } - // can match any type in the range of the type variable... - // XXX what about interfaces? - private boolean matchingBounds(TypeVariableReferenceType tvrt) { - 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 - ReferenceType[] tvrtBounds = tvrt.getAdditionalBounds(); - if ((tvrtBounds != null) != (additionalInterfaceBounds != null)) return false; - if (additionalInterfaceBounds != null) { - // we both have bounds, compare - if (tvrtBounds.length != additionalInterfaceBounds.length) return false; - Set aAndNotB = new HashSet(); - Set bAndNotA = new HashSet(); - for (int i = 0; i < additionalInterfaceBounds.length; i++) { - aAndNotB.add(additionalInterfaceBounds[i]); - } - for (int i = 0; i < tvrtBounds.length; i++) { - bAndNotA.add(tvrtBounds[i]); - } - for (int i = 0; i < additionalInterfaceBounds.length; i++) { - bAndNotA.remove(additionalInterfaceBounds[i]); - } - for (int i = 0; i < tvrtBounds.length; i++) { - aAndNotB.remove(tvrtBounds[i]); - } - if (! (aAndNotB.isEmpty() && bAndNotA.isEmpty()) ) return false; - } - return true; - } - private boolean isASubtypeOf(UnresolvedType candidateSuperType, UnresolvedType candidateSubType) { ResolvedType superType = (ResolvedType) candidateSuperType; ResolvedType subType = (ResolvedType) candidateSubType; |