mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-127668 Smart type completion prefers constants to fields, normal completion prefers fields to constants
This commit is contained in:
@@ -138,8 +138,8 @@ public class PreferByKindWeigher extends LookupElementWeigher {
|
||||
qualifiedWithField,
|
||||
qualifiedWithGetter,
|
||||
superMethodParameters,
|
||||
expectedTypeConstant,
|
||||
field,
|
||||
expectedTypeConstant,
|
||||
getter,
|
||||
normal,
|
||||
collectionFactory,
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
public class Foo {
|
||||
|
||||
private LocalDate dateField;
|
||||
|
||||
void foo(LocalDate date) {
|
||||
|
||||
}
|
||||
|
||||
void bar() {
|
||||
foo(<caret>)
|
||||
}
|
||||
}
|
||||
|
||||
class LocalDate {
|
||||
public static final LocalDate MAX;
|
||||
public static final LocalDate MIN;
|
||||
}
|
||||
+4
@@ -160,6 +160,10 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
checkPreferredItems(0, "myVersion", "getVersion", "getSelectedVersion", "calculateVersion");
|
||||
}
|
||||
|
||||
public void testPreferFieldsToConstants() {
|
||||
checkPreferredItems(0, "dateField", "LocalDate.MAX", "LocalDate.MIN");
|
||||
}
|
||||
|
||||
public void testPreferParametersToGetters() throws Throwable {
|
||||
checkPreferredItems(0, "a", "I._1", "getLastI", "valueOf");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user