mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
prefer local variables over NULL_PSI_ELEMENT in smart completion
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
class Usage {
|
||||
void foo(PsiMethod method) {
|
||||
PsiUtil.ensureValid(<caret>);
|
||||
}
|
||||
}
|
||||
|
||||
class PsiUtil {
|
||||
static final PsiElement NULL_PSI_ELEMENT;
|
||||
|
||||
static void ensureValid(PsiElement e) {}
|
||||
}
|
||||
|
||||
interface PsiElement {}
|
||||
interface PsiMethod extends PsiElement {}
|
||||
@@ -324,7 +324,7 @@ class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
}
|
||||
|
||||
void testPreferLocalOverThis() {
|
||||
checkPreferredItems 0, 'value', 'hashCode', 'this'
|
||||
checkPreferredItems 0, 'value', 'this', 'hashCode'
|
||||
}
|
||||
|
||||
void testGetLogger() {
|
||||
@@ -340,7 +340,7 @@ class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
}
|
||||
|
||||
void testPreferLocalWildcardClassOverObject() {
|
||||
checkPreferredItems 0, 'type', 'forName', 'forName', 'Object.class'
|
||||
checkPreferredItems 0, 'type', 'Object.class', 'forName', 'forName'
|
||||
}
|
||||
|
||||
void testPreferStringsInStringConcatenation() {
|
||||
@@ -369,6 +369,10 @@ class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
assert LookupElementPresentation.renderElement(items[1]).itemText == 'BiMap.builder'
|
||||
}
|
||||
|
||||
void testPreferExpectedLocalOverExactlyDefaultMember() {
|
||||
checkPreferredItems 0, 'method', 'PsiUtil.NULL_PSI_ELEMENT'
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return JavaTestUtil.getRelativeJavaTestDataPath() + BASE_PATH
|
||||
|
||||
@@ -833,7 +833,7 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
|
||||
}
|
||||
public void testNoClassLiteral() throws Exception {
|
||||
doActionTest();
|
||||
assertStringItems("forName", "forName", "Object.class", "getClass");
|
||||
assertStringItems("Object.class", "getClass", "forName", "forName");
|
||||
}
|
||||
|
||||
public void testClassLiteralInAnno2() throws Throwable {
|
||||
|
||||
Reference in New Issue
Block a user