mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-152033 Suggest current class for Class<?> parameter (for logging-related stuff)
This commit is contained in:
@@ -1154,7 +1154,8 @@ public class ExpectedTypesProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("Logger".equals(containingClass.getName()) || "Log".equals(containingClass.getName())) {
|
||||
String className = containingClass.getName();
|
||||
if (className != null && className.startsWith("Log")) {
|
||||
if (parameterType instanceof PsiClassType) {
|
||||
PsiType typeArg = PsiUtil.substituteTypeParameter(parameterType, CommonClassNames.JAVA_LANG_CLASS, 0, true);
|
||||
if (typeArg != null && TypeConversionUtil.erasure(typeArg).equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) {
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
public class Foo {
|
||||
public static final Logger LOG = LoggerFactory.getLogger(<caret>)
|
||||
}
|
||||
|
||||
class LoggerFactory {
|
||||
static Logger getLogger(Class<?> c) {}
|
||||
}
|
||||
+3
@@ -324,6 +324,9 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
public void testGetWildcardLogger() {
|
||||
checkPreferredItems 0, 'Foo.class', 'forName'
|
||||
}
|
||||
public void testGetWildcardFactoryLogger() {
|
||||
checkPreferredItems 0, 'Foo.class', 'forName'
|
||||
}
|
||||
public void testPreferLocalWildcardClassOverObject() {
|
||||
checkPreferredItems 0, 'type', 'Object.class'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user