mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
IDEA-175677 Duplicate generic method suggestion when inheriting from a raw type
This commit is contained in:
+6
-2
@@ -16,13 +16,15 @@
|
||||
package com.intellij.codeInsight.completion.scope;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Trinity;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.MethodSignature;
|
||||
import com.intellij.psi.util.MethodSignatureUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class CompletionElement{
|
||||
private final Object myElement;
|
||||
private final PsiSubstitutor mySubstitutor;
|
||||
@@ -63,7 +65,9 @@ public class CompletionElement{
|
||||
return ((PsiPackage)myElement).getQualifiedName();
|
||||
}
|
||||
if(myElement instanceof PsiMethod){
|
||||
return Pair.create(((PsiMethod)myElement).getSignature(mySubstitutor), myQualifierText);
|
||||
return Trinity.create(((PsiMethod)myElement).getName(),
|
||||
Arrays.asList(MethodSignatureUtil.calcErasedParameterTypes(((PsiMethod)myElement).getSignature(mySubstitutor))),
|
||||
myQualifierText);
|
||||
}
|
||||
if (myElement instanceof PsiVariable) {
|
||||
return "#" + ((PsiVariable)myElement).getName();
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
interface I {
|
||||
int indexOf(Enum<?> e);
|
||||
}
|
||||
abstract class C<T> implements I {
|
||||
@Override
|
||||
public int indexOf(Enum<?> e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class C2 extends C {
|
||||
{
|
||||
inde<caret>x
|
||||
}
|
||||
}
|
||||
+6
@@ -1785,4 +1785,10 @@ class Bar {
|
||||
doTest('<')
|
||||
}
|
||||
|
||||
void testDuplicateGenericMethodSuggestionWhenInheritingFromRawType() {
|
||||
CodeInsightSettings.instance.AUTOINSERT_PAIR_BRACKET = false
|
||||
configure()
|
||||
assert myFixture.lookupElementStrings == ['indexOf']
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user