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 |
Object value = invocations.get(mec); |
2540 |
int invalidSize = invalidInvocations.size(); |
2540 |
if (value instanceof List) { |
2541 |
if (invalidSize > 1) { |
2541 |
List invalidInvocations = (List) value; |
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-2766
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, Object invocationValue, List lubStack) { |
2760 |
if (invocations == null) return mec; // no alternate invocation |
2760 |
if (invocationValue == null) return mec; // no alternate invocation |
2761 |
int length = invocations.size(); |
2761 |
if (!(invocationValue instanceof List)) { // only one invocation, simply return it (list only allocated if more than one) |
|
|
2762 |
return (TypeBinding) invocationValue; |
2763 |
} |
2764 |
List invocations = (List) invocationValue; |
2762 |
Iterator iter = invocations.iterator(); |
2765 |
Iterator iter = invocations.iterator(); |
2763 |
if (length == 1) return (TypeBinding) iter.next(); |
|
|
2764 |
|
2766 |
|
2765 |
// if mec is an array type, intersect invocation leaf component types, then promote back to array |
2767 |
// if mec is an array type, intersect invocation leaf component types, then promote back to array |
2766 |
int dim = mec.dimensions(); |
2768 |
int dim = mec.dimensions(); |
Lines 2928-2934
Link Here
|
2928 |
for (int i = 0; i < length; i++) { |
2930 |
for (int i = 0; i < length; i++) { |
2929 |
TypeBinding mec = mecs[i]; |
2931 |
TypeBinding mec = mecs[i]; |
2930 |
if (mec == null) continue; |
2932 |
if (mec == null) continue; |
2931 |
mec = leastContainingInvocation(mec, (Set)invocations.get(mec), lubStack); |
2933 |
mec = leastContainingInvocation(mec, invocations.get(mec), lubStack); |
2932 |
if (mec == null) return null; |
2934 |
if (mec == null) return null; |
2933 |
int dim = mec.dimensions(); |
2935 |
int dim = mec.dimensions(); |
2934 |
if (commonDim == -1) { |
2936 |
if (commonDim == -1) { |
Lines 3001-3009
Link Here
|
3001 |
TypeBinding leafType = firstType.leafComponentType(); |
3003 |
TypeBinding leafType = firstType.leafComponentType(); |
3002 |
TypeBinding firstErasure = (leafType.isTypeVariable() || leafType.isWildcard()/*&& !leafType.isCapture()*/) ? firstType : firstType.erasure(); |
3004 |
TypeBinding firstErasure = (leafType.isTypeVariable() || leafType.isWildcard()/*&& !leafType.isCapture()*/) ? firstType : firstType.erasure(); |
3003 |
if (firstErasure != firstType) { |
3005 |
if (firstErasure != firstType) { |
3004 |
Set someInvocations = new HashSet(1); |
3006 |
allInvocations.put(firstErasure, firstType); |
3005 |
someInvocations.add(firstType); |
|
|
3006 |
allInvocations.put(firstErasure, someInvocations); |
3007 |
} |
3007 |
} |
3008 |
typesToVisit.add(firstType); |
3008 |
typesToVisit.add(firstType); |
3009 |
int max = 1; |
3009 |
int max = 1; |
Lines 3063-3071
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 |
allInvocations.put(superTypeErasure, superType); |
3067 |
someInvocations.add(superType); |
|
|
3068 |
allInvocations.put(superTypeErasure, someInvocations); |
3069 |
} |
3067 |
} |
3070 |
} |
3068 |
} |
3071 |
continue; |
3069 |
continue; |
Lines 3082-3090
Link Here
|
3082 |
max++; |
3080 |
max++; |
3083 |
TypeBinding superTypeErasure = (itsInterface.isTypeVariable() || itsInterface.isWildcard() /*&& !itsInterface.isCapture()*/) ? superType : superType.erasure(); |
3081 |
TypeBinding superTypeErasure = (itsInterface.isTypeVariable() || itsInterface.isWildcard() /*&& !itsInterface.isCapture()*/) ? superType : superType.erasure(); |
3084 |
if (superTypeErasure != superType) { |
3082 |
if (superTypeErasure != superType) { |
3085 |
Set someInvocations = new HashSet(1); |
3083 |
allInvocations.put(superTypeErasure, superType); |
3086 |
someInvocations.add(superType); |
|
|
3087 |
allInvocations.put(superTypeErasure, someInvocations); |
3088 |
} |
3084 |
} |
3089 |
} |
3085 |
} |
3090 |
} |
3086 |
} |
Lines 3097-3105
Link Here
|
3097 |
max++; |
3093 |
max++; |
3098 |
TypeBinding superTypeErasure = (itsSuperclass.isTypeVariable() || itsSuperclass.isWildcard() /*&& !itsSuperclass.isCapture()*/) ? superType : superType.erasure(); |
3094 |
TypeBinding superTypeErasure = (itsSuperclass.isTypeVariable() || itsSuperclass.isWildcard() /*&& !itsSuperclass.isCapture()*/) ? superType : superType.erasure(); |
3099 |
if (superTypeErasure != superType) { |
3095 |
if (superTypeErasure != superType) { |
3100 |
Set someInvocations = new HashSet(1); |
3096 |
allInvocations.put(superTypeErasure, superType); |
3101 |
someInvocations.add(superType); |
|
|
3102 |
allInvocations.put(superTypeErasure, someInvocations); |
3103 |
} |
3097 |
} |
3104 |
} |
3098 |
} |
3105 |
} |
3099 |
} |
Lines 3128-3137
Link Here
|
3128 |
continue nextSuperType; |
3122 |
continue nextSuperType; |
3129 |
} |
3123 |
} |
3130 |
// record invocation |
3124 |
// record invocation |
3131 |
Set someInvocations = (Set) allInvocations.get(erasedSuperType); |
3125 |
Object value = allInvocations.get(erasedSuperType); |
3132 |
if (someInvocations == null) someInvocations = new HashSet(1); |
3126 |
if (value == null) { |
3133 |
someInvocations.add(match); |
3127 |
allInvocations.put(erasedSuperType, match); |
3134 |
allInvocations.put(erasedSuperType, someInvocations); |
3128 |
} else if (!(value instanceof List)) { |
|
|
3129 |
if (match != value) { |
3130 |
// using a list to record invocations in order (188103) |
3131 |
List someInvocations = new ArrayList(2); |
3132 |
someInvocations.add(value); |
3133 |
someInvocations.add(match); |
3134 |
allInvocations.put(erasedSuperType, someInvocations); |
3135 |
} |
3136 |
} else { |
3137 |
List someInvocations = (List) value; |
3138 |
if (!someInvocations.contains(match)) { |
3139 |
someInvocations.add(match); |
3140 |
allInvocations.put(erasedSuperType, someInvocations); |
3141 |
} |
3142 |
} |
3135 |
} |
3143 |
} |
3136 |
continue nextOtherType; |
3144 |
continue nextOtherType; |
3137 |
} |
3145 |
} |
Lines 3154-3163
Link Here
|
3154 |
} |
3162 |
} |
3155 |
} |
3163 |
} |
3156 |
// record invocation |
3164 |
// record invocation |
3157 |
Set someInvocations = (Set) allInvocations.get(erasedSuperType); |
3165 |
Object value = allInvocations.get(erasedSuperType); |
3158 |
if (someInvocations == null) someInvocations = new HashSet(1); |
3166 |
if (value == null) { |
3159 |
someInvocations.add(match); |
3167 |
allInvocations.put(erasedSuperType, match); |
3160 |
allInvocations.put(erasedSuperType, someInvocations); |
3168 |
} else if (!(value instanceof List)) { |
|
|
3169 |
if (match != value) { |
3170 |
// using a list to record invocations in order (188103) |
3171 |
List someInvocations = new ArrayList(2); |
3172 |
someInvocations.add(value); |
3173 |
someInvocations.add(match); |
3174 |
allInvocations.put(erasedSuperType, someInvocations); |
3175 |
} |
3176 |
} else { |
3177 |
List someInvocations = (List) value; |
3178 |
if (!someInvocations.contains(match)) { |
3179 |
someInvocations.add(match); |
3180 |
allInvocations.put(erasedSuperType, someInvocations); |
3181 |
} |
3182 |
} |
3161 |
} |
3183 |
} |
3162 |
} |
3184 |
} |
3163 |
// eliminate non minimal super types |
3185 |
// eliminate non minimal super types |