mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java smart completion: don't suggest generic call variants with inapplicable types
This commit is contained in:
@@ -119,7 +119,8 @@ public class AssignableFromFilter implements ElementFilter{
|
||||
expectedType,
|
||||
false,
|
||||
PsiUtil.getLanguageLevel(place));
|
||||
if (substitutionForParameter != PsiType.NULL && !(substitutionForParameter instanceof PsiIntersectionType)) {
|
||||
if (substitutionForParameter != PsiType.NULL && !(substitutionForParameter instanceof PsiIntersectionType) &&
|
||||
PsiUtil.resolveClassInClassTypeOnly(substitutionForParameter) != parameter) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class A {
|
||||
{
|
||||
Func2<String,String> f = ge<caret>x
|
||||
}
|
||||
|
||||
<T,V> Func1<T,V> get1() {}
|
||||
<T,V> Func2<T,V> get2() {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface Func1<T, V> {}
|
||||
interface Func2<T, V> {}
|
||||
+5
@@ -175,4 +175,9 @@ public void testConvertToObjectStream() {
|
||||
}
|
||||
checkResultByFile("/" + getTestName(false) + "-out.java");
|
||||
}
|
||||
|
||||
public void testOnlyCompatibleTypes() {
|
||||
configureByTestName();
|
||||
assertOrderedEquals(myFixture.getLookupElementStrings(), "get2");
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -1232,4 +1232,9 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
|
||||
private CommonCodeStyleSettings getCodeStyleSettings() {
|
||||
return CodeStyleSettingsManager.getSettings(getProject()).getCommonSettings(JavaLanguage.INSTANCE);
|
||||
}
|
||||
|
||||
public void testOnlyCompatibleTypes() {
|
||||
configureByTestName();
|
||||
assertOrderedEquals(myFixture.getLookupElementStrings(), "get2");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user