mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java completion: don't deselect TreeMap (IDEA-189544)
it wasn't preselected because there were 8 signatures "to implement", coming from Map default methods
This commit is contained in:
+6
-2
@@ -16,7 +16,7 @@
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.ExpectedTypeInfo;
|
||||
import com.intellij.codeInsight.generation.OverrideImplementUtil;
|
||||
import com.intellij.codeInsight.generation.OverrideImplementExploreUtil;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.statistics.StatisticsManager;
|
||||
@@ -65,7 +65,11 @@ public class AbstractExpectedTypeSkipper extends CompletionPreselectSkipper {
|
||||
}
|
||||
}
|
||||
|
||||
toImplement += OverrideImplementUtil.getMethodSignaturesToImplement(psiClass).size();
|
||||
toImplement += OverrideImplementExploreUtil.getMapToOverrideImplement(psiClass, true)
|
||||
.values()
|
||||
.stream()
|
||||
.filter(c -> ((PsiMethod)c.getElement()).hasModifierProperty(PsiModifier.ABSTRACT))
|
||||
.count();
|
||||
if (toImplement > 2) return Result.ABSTRACT;
|
||||
|
||||
final ExpectedTypeInfo[] infos = JavaCompletionUtil.EXPECTED_TYPES.getValue(location);
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import java.util.*;
|
||||
|
||||
class F {
|
||||
{
|
||||
SortedMap<String, String> m = new <caret>
|
||||
}
|
||||
}
|
||||
+5
@@ -269,4 +269,9 @@ public void testConvertToObjectStream() {
|
||||
assertOrderedEquals(myFixture.getLookupElementStrings(), "() -> ");
|
||||
}
|
||||
|
||||
public void testPreselectTreeMapWhenSortedMapExpected() {
|
||||
configureByTestName();
|
||||
myFixture.assertPreferredCompletionItems(2, "SortedMap", "NavigableMap", "TreeMap", "ConcurrentNavigableMap", "ConcurrentSkipListMap");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user