View | Details | Raw Unified | Return to bug 127583
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java (-4 / +18 lines)
Lines 397-410 Link Here
397
			}
397
			}
398
			WildcardBinding otherWildcard = (WildcardBinding) otherType;
398
			WildcardBinding otherWildcard = (WildcardBinding) otherType;
399
			if (otherWildcard.otherBounds != null) return false; // not a true wildcard (intersection type)
399
			if (otherWildcard.otherBounds != null) return false; // not a true wildcard (intersection type)
400
			TypeBinding otherBound = otherWildcard.bound;
400
			switch(otherWildcard.boundKind) {
401
			switch(otherWildcard.boundKind) {
401
				case Wildcard.EXTENDS:
402
				case Wildcard.EXTENDS:
402
					if (otherWildcard.bound == this) return true; // ? extends T  <=  ? extends ? extends T
403
					if (otherBound == this) return true; // ? extends T  <=  ? extends ? extends T
403
					return upperBound != null && upperBound.isCompatibleWith(otherWildcard.bound);
404
					if (upperBound instanceof ReferenceBinding) {
405
						ReferenceBinding match = ((ReferenceBinding)upperBound).findSuperTypeWithSameErasure(otherBound);
406
						if (match != null && match.isRawType()) {
407
							return match == otherBound; // forbide: Collection <=  ? extends Collection<?>
408
						}
409
					}
410
					return upperBound != null && upperBound.isCompatibleWith(otherBound);
404
	
411
	
405
				case Wildcard.SUPER :
412
				case Wildcard.SUPER :
406
					if (otherWildcard.bound == this) return true; // ? super T  <=  ? super ? super T
413
					if (otherBound == this) return true; // ? super T  <=  ? super ? super T
407
					return lowerBound != null && otherWildcard.bound.isCompatibleWith(lowerBound);
414
					if (lowerBound == null) return false;
415
					if (otherBound instanceof ReferenceBinding) {
416
						ReferenceBinding match = ((ReferenceBinding)otherBound).findSuperTypeWithSameErasure(lowerBound);
417
						if (match != null && match.isRawType()) {
418
							return match == lowerBound; // forbide: Collection <=  ? super Collection<?>
419
						}
420
					}
421
					return otherBound.isCompatibleWith(lowerBound);
408
	
422
	
409
				case Wildcard.UNBOUND :
423
				case Wildcard.UNBOUND :
410
				default:
424
				default:

Return to bug 127583