IDEA-76874 Basic completion doesn't show methods when they do not suite by return type

This commit is contained in:
peter
2011-11-21 17:47:43 +01:00
parent 0970443ba5
commit 3cecea38f2
5 changed files with 2 additions and 29 deletions
@@ -267,8 +267,6 @@ public class JavaCompletionContributor extends CompletionContributor {
if (reference instanceof PsiJavaReference) {
final ElementFilter filter = getReferenceFilter(position);
if (filter != null) {
boolean filterVoid = JavaSmartCompletionContributor.getExpectedTypes(parameters).length > 0 && parameters.getInvocationCount() < 2;
final boolean isSwitchLabel = SWITCH_LABEL.accepts(position);
final PsiFile originalFile = parameters.getOriginalFile();
for (LookupElement element : JavaCompletionUtil.processJavaReference(position,
@@ -290,11 +288,6 @@ public class JavaCompletionContributor extends CompletionContributor {
item.setTailType(TailType.NONE);
}
Object object = element.getObject();
if (filterVoid && object instanceof PsiMethod && PsiType.VOID.equals(((PsiMethod)object).getReturnType())) {
continue;
}
result.addElement(element);
}
}
@@ -1,5 +0,0 @@
public class Foo {
Object foo(){
return noti<caret>
}
}
@@ -1,5 +0,0 @@
public class Foo {
Object foo(){
return notify<caret>
}
}
@@ -47,7 +47,7 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
}
public void testReturnF() throws Throwable {
checkPreferredItems(0, "false");
checkPreferredItems(0, "false", "finalize");
}
public void testPreferDefaultTypeToExpected() throws Throwable {
@@ -727,7 +727,7 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
public void testDoubleFalse() throws Throwable {
configureByFile(getTestName(false) + ".java");
assertStringItems("false", "fefefef");
assertStringItems("false", "fefefef", "finalize");
}
public void testSameNamedVariableInNestedClasses() throws Throwable {
@@ -895,16 +895,6 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
}
}
public void testVoidMethodsInNonVoidContext() throws Throwable {
configure()
checkResultByFile(getTestName(false) + ".java")
assertEmpty(myItems)
assertNull(getLookup());
myFixture.complete(CompletionType.BASIC, 2)
checkResult()
}
public void testEnumConstantFromEnumMember() throws Throwable { doTest(); }
public void testPrimitiveMethodParameter() throws Throwable { doTest(); }