### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v retrieving revision 1.307 diff -u -r1.307 Scope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 16 May 2007 20:49:40 -0000 1.307 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 21 May 2007 19:30:24 -0000 @@ -2536,12 +2536,12 @@ nextCandidate: for (int k = 0, max = mecs.length; k < max; k++) { TypeBinding mec = mecs[k]; if (mec == null) continue nextCandidate; - Set invalidInvocations = (Set) invocations.get(mec); + List invalidInvocations = (List) invocations.get(mec); int invalidSize = invalidInvocations.size(); if (invalidSize > 1) { - TypeBinding[] collisions; - invalidInvocations.toArray(collisions = new TypeBinding[invalidSize]); - problemReporter().superinterfacesCollide(collisions[0].erasure(), typeRef, collisions[0], collisions[1]); + TypeBinding firstInvocation = (TypeBinding) invalidInvocations.get(0); + TypeBinding secondInvocation = (TypeBinding) invalidInvocations.get(1); + problemReporter().superinterfacesCollide(firstInvocation.erasure(), typeRef, firstInvocation, secondInvocation); type.tagBits |= TagBits.HierarchyHasProblems; return true; } @@ -2756,7 +2756,7 @@ return false; } - private TypeBinding leastContainingInvocation(TypeBinding mec, Set invocations, List lubStack) { + private TypeBinding leastContainingInvocation(TypeBinding mec, List invocations, List lubStack) { if (invocations == null) return mec; // no alternate invocation int length = invocations.size(); Iterator iter = invocations.iterator(); @@ -2928,7 +2928,7 @@ for (int i = 0; i < length; i++) { TypeBinding mec = mecs[i]; if (mec == null) continue; - mec = leastContainingInvocation(mec, (Set)invocations.get(mec), lubStack); + mec = leastContainingInvocation(mec, (List)invocations.get(mec), lubStack); if (mec == null) return null; int dim = mec.dimensions(); if (commonDim == -1) { @@ -3001,7 +3001,7 @@ TypeBinding leafType = firstType.leafComponentType(); TypeBinding firstErasure = (leafType.isTypeVariable() || leafType.isWildcard()/*&& !leafType.isCapture()*/) ? firstType : firstType.erasure(); if (firstErasure != firstType) { - Set someInvocations = new HashSet(1); + List someInvocations = new ArrayList(1); someInvocations.add(firstType); allInvocations.put(firstErasure, someInvocations); } @@ -3063,7 +3063,7 @@ max++; TypeBinding superTypeErasure = (firstBound.isTypeVariable() || firstBound.isWildcard() /*&& !itsInterface.isCapture()*/) ? superType : superType.erasure(); if (superTypeErasure != superType) { - Set someInvocations = new HashSet(1); + List someInvocations = new ArrayList(1); someInvocations.add(superType); allInvocations.put(superTypeErasure, someInvocations); } @@ -3082,7 +3082,7 @@ max++; TypeBinding superTypeErasure = (itsInterface.isTypeVariable() || itsInterface.isWildcard() /*&& !itsInterface.isCapture()*/) ? superType : superType.erasure(); if (superTypeErasure != superType) { - Set someInvocations = new HashSet(1); + List someInvocations = new ArrayList(1); someInvocations.add(superType); allInvocations.put(superTypeErasure, someInvocations); } @@ -3097,7 +3097,7 @@ max++; TypeBinding superTypeErasure = (itsSuperclass.isTypeVariable() || itsSuperclass.isWildcard() /*&& !itsSuperclass.isCapture()*/) ? superType : superType.erasure(); if (superTypeErasure != superType) { - Set someInvocations = new HashSet(1); + List someInvocations = new ArrayList(1); someInvocations.add(superType); allInvocations.put(superTypeErasure, someInvocations); } @@ -3128,9 +3128,14 @@ continue nextSuperType; } // record invocation - Set someInvocations = (Set) allInvocations.get(erasedSuperType); - if (someInvocations == null) someInvocations = new HashSet(1); - someInvocations.add(match); + List someInvocations = (List) allInvocations.get(erasedSuperType); + if (someInvocations == null) { + someInvocations = new ArrayList(1); + someInvocations.add(match); + } else { + // using a list to record invocations in order (188103) + if (!someInvocations.contains(match)) someInvocations.add(match); + } allInvocations.put(erasedSuperType, someInvocations); } continue nextOtherType; @@ -3154,9 +3159,14 @@ } } // record invocation - Set someInvocations = (Set) allInvocations.get(erasedSuperType); - if (someInvocations == null) someInvocations = new HashSet(1); - someInvocations.add(match); + List someInvocations = (List) allInvocations.get(erasedSuperType); + if (someInvocations == null) { + someInvocations = new ArrayList(1); + someInvocations.add(match); + } else { + // using a list to record invocations in order (188103) + if (!someInvocations.contains(match)) someInvocations.add(match); + } allInvocations.put(erasedSuperType, someInvocations); } }