diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java index 36d9714862d1..b66073e2f6f0 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java @@ -75,11 +75,12 @@ public class JavaCompletionSorting { if (!smart) { ContainerUtil.addIfNotNull(afterPrefix, preferStatics(position, expectedTypes)); } - ContainerUtil.addIfNotNull(afterPrefix, recursion(parameters, expectedTypes)); if (!smart && !afterNew) { afterPrefix.add(new PreferExpected(false, expectedTypes)); } - Collections.addAll(afterPrefix, new PreferByKindWeigher(type, position), new PreferSimilarlyEnding(expectedTypes), + afterPrefix.add(new PreferByKindWeigher(type, position)); + ContainerUtil.addIfNotNull(afterPrefix, recursion(parameters, expectedTypes)); + Collections.addAll(afterPrefix, new PreferSimilarlyEnding(expectedTypes), new PreferNonGeneric(), new PreferAccessible(position), new PreferSimple()); sorter = sorter.weighAfter("prefix", afterPrefix.toArray(new LookupElementWeigher[afterPrefix.size()])); diff --git a/java/java-tests/testData/codeInsight/completion/normalSorting/DispreferDeclaredOfExpectedType.java b/java/java-tests/testData/codeInsight/completion/normalSorting/DispreferDeclaredOfExpectedType.java deleted file mode 100644 index 4acc0b1cc375..000000000000 --- a/java/java-tests/testData/codeInsight/completion/normalSorting/DispreferDeclaredOfExpectedType.java +++ /dev/null @@ -1,9 +0,0 @@ -public class Aaaaaaa { - private final String aaa; - - Aaaaaaa(Object aabbb) { - aaa = ""; - aaa = true ? null : aa - } - -} diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy index 5c1683c9eee2..64dba685bddc 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionOrderingTest.groovy @@ -117,10 +117,6 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase { checkPreferredItems(0, "aabbb", "aaa"); } - public void testDispreferDeclaredOfExpectedType() throws Throwable { - checkPreferredItems(0, "aabbb", "aaa"); - } - public void testDispreferImpls() throws Throwable { myFixture.addClass("package foo; public class Xxx {}"); configureSecondCompletion(); @@ -456,7 +452,7 @@ interface TxANotAnno {} myFixture.addClass('public class fooAClass {}') configureNoCompletion(getTestName(false) + ".java"); myFixture.complete(CompletionType.BASIC, 2); - assertPreferredItems(0, 'fooy', 'fooAClass', 'fooBar', 'foox'); + assertPreferredItems(0, 'fooy', 'foox', 'fooAClass', 'fooBar'); } public void testChangePreselectionOnSecondInvocation() { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy index 1aebb295e3ac..b19da5ac6f67 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionOrderingTest.groovy @@ -161,7 +161,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { } public void testPreferParametersToGetters() throws Throwable { - checkPreferredItems(0, "a", "I._1", "valueOf", "getLastI"); + checkPreferredItems(0, "a", "I._1", "getLastI", "valueOf"); } public void testExpectedInterfaceShouldGoFirst() throws Throwable { @@ -178,7 +178,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { } public void testPreferNonRecursiveMethodParams() throws Throwable { - checkPreferredItems(0, "b", "hashCode", "s", "a"); + checkPreferredItems(0, "b", "s", "a", "hashCode"); } public void testPreferDelegatingMethodParams() throws Throwable { @@ -302,7 +302,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase { } public void testDispreferGetterInSetterCall() { - checkPreferredItems 0, 'getZooColor', 'hashCode', 'color', 'getColor' + checkPreferredItems 0, 'color', 'getZooColor', 'getColor', 'hashCode' } public void testPreferOtherGetterInSetterCall() { checkPreferredItems 0, 'color', 'getColor', 'getZooColor', 'hashCode'