View | Details | Raw Unified | Return to bug 188103 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-16 / +26 lines)
Lines 2536-2547 Link Here
2536
			nextCandidate: for (int k = 0, max = mecs.length; k < max; k++) {
2536
			nextCandidate: for (int k = 0, max = mecs.length; k < max; k++) {
2537
				TypeBinding mec = mecs[k];
2537
				TypeBinding mec = mecs[k];
2538
				if (mec == null) continue nextCandidate;
2538
				if (mec == null) continue nextCandidate;
2539
				Set invalidInvocations = (Set) invocations.get(mec);
2539
				List invalidInvocations = (List) invocations.get(mec);
2540
				int invalidSize = invalidInvocations.size();
2540
				int invalidSize = invalidInvocations.size();
2541
				if (invalidSize > 1) {
2541
				if (invalidSize > 1) {
2542
					TypeBinding[] collisions;
2542
					TypeBinding firstInvocation = (TypeBinding) invalidInvocations.get(0);
2543
					invalidInvocations.toArray(collisions = new TypeBinding[invalidSize]);
2543
					TypeBinding secondInvocation = (TypeBinding) invalidInvocations.get(1);
2544
					problemReporter().superinterfacesCollide(collisions[0].erasure(), typeRef, collisions[0], collisions[1]);
2544
					problemReporter().superinterfacesCollide(firstInvocation.erasure(), typeRef, firstInvocation, secondInvocation);
2545
					type.tagBits |= TagBits.HierarchyHasProblems;
2545
					type.tagBits |= TagBits.HierarchyHasProblems;
2546
					return true;
2546
					return true;
2547
				}
2547
				}
Lines 2756-2762 Link Here
2756
		return false;
2756
		return false;
2757
	}
2757
	}
2758
2758
2759
	private TypeBinding leastContainingInvocation(TypeBinding mec, Set invocations, List lubStack) {
2759
	private TypeBinding leastContainingInvocation(TypeBinding mec, List invocations, List lubStack) {
2760
		if (invocations == null) return mec; // no alternate invocation
2760
		if (invocations == null) return mec; // no alternate invocation
2761
		int length = invocations.size();
2761
		int length = invocations.size();
2762
		Iterator iter = invocations.iterator();
2762
		Iterator iter = invocations.iterator();
Lines 2928-2934 Link Here
2928
		for (int i = 0; i < length; i++) {
2928
		for (int i = 0; i < length; i++) {
2929
			TypeBinding mec = mecs[i];
2929
			TypeBinding mec = mecs[i];
2930
			if (mec == null) continue;
2930
			if (mec == null) continue;
2931
			mec = leastContainingInvocation(mec, (Set)invocations.get(mec), lubStack);
2931
			mec = leastContainingInvocation(mec, (List)invocations.get(mec), lubStack);
2932
			if (mec == null) return null;
2932
			if (mec == null) return null;
2933
			int dim = mec.dimensions();
2933
			int dim = mec.dimensions();
2934
			if (commonDim == -1) {
2934
			if (commonDim == -1) {
Lines 3001-3007 Link Here
3001
		TypeBinding leafType = firstType.leafComponentType();
3001
		TypeBinding leafType = firstType.leafComponentType();
3002
		TypeBinding firstErasure = (leafType.isTypeVariable() || leafType.isWildcard()/*&& !leafType.isCapture()*/) ? firstType : firstType.erasure();
3002
		TypeBinding firstErasure = (leafType.isTypeVariable() || leafType.isWildcard()/*&& !leafType.isCapture()*/) ? firstType : firstType.erasure();
3003
		if (firstErasure != firstType) {
3003
		if (firstErasure != firstType) {
3004
			Set someInvocations = new HashSet(1);
3004
			List someInvocations = new ArrayList(1);
3005
			someInvocations.add(firstType);
3005
			someInvocations.add(firstType);
3006
			allInvocations.put(firstErasure, someInvocations);
3006
			allInvocations.put(firstErasure, someInvocations);
3007
		}						
3007
		}						
Lines 3063-3069 Link Here
3063
						max++;
3063
						max++;
3064
						TypeBinding superTypeErasure = (firstBound.isTypeVariable() || firstBound.isWildcard() /*&& !itsInterface.isCapture()*/) ? superType : superType.erasure();
3064
						TypeBinding superTypeErasure = (firstBound.isTypeVariable() || firstBound.isWildcard() /*&& !itsInterface.isCapture()*/) ? superType : superType.erasure();
3065
						if (superTypeErasure != superType) {
3065
						if (superTypeErasure != superType) {
3066
							Set someInvocations = new HashSet(1);
3066
							List someInvocations = new ArrayList(1);
3067
							someInvocations.add(superType);
3067
							someInvocations.add(superType);
3068
							allInvocations.put(superTypeErasure, someInvocations);
3068
							allInvocations.put(superTypeErasure, someInvocations);
3069
						}						
3069
						}						
Lines 3082-3088 Link Here
3082
						max++;
3082
						max++;
3083
						TypeBinding superTypeErasure = (itsInterface.isTypeVariable() || itsInterface.isWildcard() /*&& !itsInterface.isCapture()*/) ? superType : superType.erasure();
3083
						TypeBinding superTypeErasure = (itsInterface.isTypeVariable() || itsInterface.isWildcard() /*&& !itsInterface.isCapture()*/) ? superType : superType.erasure();
3084
						if (superTypeErasure != superType) {
3084
						if (superTypeErasure != superType) {
3085
							Set someInvocations = new HashSet(1);
3085
							List someInvocations = new ArrayList(1);
3086
							someInvocations.add(superType);
3086
							someInvocations.add(superType);
3087
							allInvocations.put(superTypeErasure, someInvocations);
3087
							allInvocations.put(superTypeErasure, someInvocations);
3088
						}						
3088
						}						
Lines 3097-3103 Link Here
3097
					max++;
3097
					max++;
3098
					TypeBinding superTypeErasure = (itsSuperclass.isTypeVariable() || itsSuperclass.isWildcard() /*&& !itsSuperclass.isCapture()*/) ? superType : superType.erasure();
3098
					TypeBinding superTypeErasure = (itsSuperclass.isTypeVariable() || itsSuperclass.isWildcard() /*&& !itsSuperclass.isCapture()*/) ? superType : superType.erasure();
3099
					if (superTypeErasure != superType) {
3099
					if (superTypeErasure != superType) {
3100
						Set someInvocations = new HashSet(1);
3100
						List someInvocations = new ArrayList(1);
3101
						someInvocations.add(superType);
3101
						someInvocations.add(superType);
3102
						allInvocations.put(superTypeErasure, someInvocations);
3102
						allInvocations.put(superTypeErasure, someInvocations);
3103
					}
3103
					}
Lines 3128-3136 Link Here
3128
						continue nextSuperType;
3128
						continue nextSuperType;
3129
					}
3129
					}
3130
					// record invocation
3130
					// record invocation
3131
					Set someInvocations = (Set) allInvocations.get(erasedSuperType);
3131
					List someInvocations = (List) allInvocations.get(erasedSuperType);
3132
					if (someInvocations == null) someInvocations = new HashSet(1);
3132
					if (someInvocations == null) {
3133
					someInvocations.add(match);
3133
						someInvocations = new ArrayList(1);
3134
						someInvocations.add(match);
3135
					} else {
3136
						// using a list to record invocations in order (188103)
3137
						if (!someInvocations.contains(match)) someInvocations.add(match);
3138
					}
3134
					allInvocations.put(erasedSuperType, someInvocations);
3139
					allInvocations.put(erasedSuperType, someInvocations);
3135
				}
3140
				}
3136
				continue nextOtherType;
3141
				continue nextOtherType;
Lines 3154-3162 Link Here
3154
					}
3159
					}
3155
				}
3160
				}
3156
				// record invocation
3161
				// record invocation
3157
				Set someInvocations = (Set) allInvocations.get(erasedSuperType);
3162
				List someInvocations = (List) allInvocations.get(erasedSuperType);
3158
				if (someInvocations == null) someInvocations = new HashSet(1);
3163
				if (someInvocations == null) {
3159
				someInvocations.add(match);
3164
					someInvocations = new ArrayList(1);
3165
					someInvocations.add(match);
3166
				} else {
3167
					// using a list to record invocations in order (188103)
3168
					if (!someInvocations.contains(match)) someInvocations.add(match);
3169
				}
3160
				allInvocations.put(erasedSuperType, someInvocations);
3170
				allInvocations.put(erasedSuperType, someInvocations);
3161
			}				
3171
			}				
3162
		}
3172
		}

Return to bug 188103