IDEA-CR-53066 java smart completion: autoinsert likely generic methods

GitOrigin-RevId: 6dcca0e0c39758de0a9c3bb77ded8b2c61ad4cf0
This commit is contained in:
Peter Gromov
2020-02-10 11:03:00 +00:00
committed by intellij-monorepo-bot
parent d58509eecb
commit 9007758412
4 changed files with 19 additions and 1 deletions
@@ -501,7 +501,11 @@ public class JavaCompletionSorting {
type = callItem.getSubstitutor().substitute(type);
}
return type instanceof PsiClassType && ((PsiClassType)type).resolve() instanceof PsiTypeParameter;
if (type instanceof PsiClassType) {
PsiClass target = ((PsiClassType)type).resolve();
return target instanceof PsiTypeParameter && ((PsiTypeParameter)target).getOwner() instanceof PsiMethod;
}
return false;
}
private static class PreferSimple extends LookupElementWeigher {
@@ -0,0 +1,6 @@
abstract class K<T> {
protected abstract T get();
private void m() {
T t = get();<caret>
}
}
@@ -0,0 +1,6 @@
abstract class K<T> {
protected abstract T get();
private void m() {
T t = g<caret>
}
}
@@ -606,6 +606,8 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
myFixture.assertPreferredCompletionItems(0, "valueOf");
}
public void testAutoInsertMethodReturningClassTypeParam() { doActionTest(); }
public void testIntPlusLongNotDouble() { doTest(); }
public void testNestedAssignments() { doTest(); }