don't mix lookup element presentations from different completion processes (EA-75299 - IAE: ContainerUtil.sort)

This commit is contained in:
peter
2015-11-16 14:16:55 +01:00
parent 01ca8b163a
commit a7db319772
@@ -51,8 +51,8 @@ public class CompletionLookupArranger extends LookupArranger {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.completion.CompletionLookupArranger");
@Nullable private static StatisticsUpdate ourPendingUpdate;
private static final Alarm ourStatsAlarm = new Alarm(ApplicationManager.getApplication());
private static final Key<String> PRESENTATION_INVARIANT = Key.create("PRESENTATION_INVARIANT");
private static final Comparator<LookupElement> BY_PRESENTATION_COMPARATOR = new Comparator<LookupElement>() {
private final Key<String> PRESENTATION_INVARIANT = Key.create("PRESENTATION_INVARIANT");
private final Comparator<LookupElement> BY_PRESENTATION_COMPARATOR = new Comparator<LookupElement>() {
@Override
public int compare(LookupElement o1, LookupElement o2) {
String invariant = PRESENTATION_INVARIANT.get(o1);
@@ -208,7 +208,7 @@ public class CompletionLookupArranger extends LookupArranger {
return tailText == null || tailText.isEmpty() ? " " : tailText;
}
private static List<LookupElement> sortByPresentation(Iterable<LookupElement> source, LookupImpl lookup) {
private List<LookupElement> sortByPresentation(Iterable<LookupElement> source, LookupImpl lookup) {
ArrayList<LookupElement> startMatches = ContainerUtil.newArrayList();
ArrayList<LookupElement> middleMatches = ContainerUtil.newArrayList();
for (LookupElement element : source) {
@@ -369,7 +369,7 @@ public class CompletionLookupArranger extends LookupArranger {
return new CompletionLookupArranger(myParameters, myProcess);
}
private static int getItemToSelect(LookupImpl lookup, List<LookupElement> items, boolean onExplicitAction, @Nullable LookupElement mostRelevant) {
private int getItemToSelect(LookupImpl lookup, List<LookupElement> items, boolean onExplicitAction, @Nullable LookupElement mostRelevant) {
if (items.isEmpty() || lookup.getFocusDegree() == LookupImpl.FocusDegree.UNFOCUSED) {
return 0;
}
@@ -577,7 +577,7 @@ public class CompletionLookupArranger extends LookupArranger {
}
}
private static class AlphaClassifier extends Classifier<LookupElement> {
private class AlphaClassifier extends Classifier<LookupElement> {
private final LookupImpl myLookup;
private AlphaClassifier(LookupImpl lookup) {