mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
IDEA-115368 Smart type completion popup offers Object.class ahead of local Class<?> variable
This commit is contained in:
@@ -331,7 +331,11 @@ public class JavaCompletionSorting {
|
||||
if (type instanceof PsiClassType) {
|
||||
final PsiClass psiClass = ((PsiClassType)type).resolve();
|
||||
if (psiClass != null && CommonClassNames.JAVA_LANG_CLASS.equals(psiClass.getQualifiedName())) {
|
||||
return GenericsUtil.eliminateWildcards(type);
|
||||
PsiClassType erased = (PsiClassType)GenericsUtil.eliminateWildcards(type);
|
||||
PsiType[] parameters = erased.getParameters();
|
||||
if (parameters.length == 1 && !parameters[0].equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) {
|
||||
return erased;
|
||||
}
|
||||
}
|
||||
}
|
||||
return type;
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class Foo {
|
||||
|
||||
static void bar(Class<?> type) {
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Class<?> type;
|
||||
bar(<caret>);
|
||||
}
|
||||
}
|
||||
+3
@@ -317,6 +317,9 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
public void testGetWildcardLogger() {
|
||||
checkPreferredItems 0, 'Foo.class', 'forName'
|
||||
}
|
||||
public void testPreferLocalWildcardClassOverObject() {
|
||||
checkPreferredItems 0, 'type', 'Object.class'
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
|
||||
Reference in New Issue
Block a user