IDEA-180276 Broken generics parameter type for completion

This commit is contained in:
Dmitry Batrak
2017-10-10 13:02:51 +03:00
parent 8351fe1616
commit 417fbcd8fc
2 changed files with 10 additions and 1 deletions
@@ -21,6 +21,7 @@ import com.intellij.openapi.editor.Inlay;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.impl.PsiImplUtil;
import com.intellij.psi.impl.source.resolve.CompletionParameterTypeInferencePolicy;
@@ -586,7 +587,8 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc
}
if (context.isSingleParameterInfo()) buffer.append("<b>");
appendModifierList(buffer, param);
buffer.append(paramType.getPresentableText(true));
String type = paramType.getPresentableText(true);
buffer.append(context.isSingleParameterInfo() ? StringUtil.escapeXml(type) : type);
String name = param.getName();
if (name != null && !context.isSingleParameterInfo()) {
buffer.append(" ");
@@ -708,6 +708,13 @@ public class CompletionHintsTest extends LightFixtureCompletionTestCase {
checkResultWithInlays("class C { void m() { String local = \"a\"; String local2 = \"b\"; System.getProperty(<hint text=\"key:\"/>local, <HINT text=\"def:\"/><caret>) } }");
}
public void testGenericType() throws Exception {
configureJava("class C { void abcd(Class<?> c) {} void m() { abc<caret> } }");
complete();
waitForAllAsyncStuff();
checkHintContents("<html><b>Class&lt;?&gt;</b></html>");
}
private void checkResult(String text) {
myFixture.checkResult(text);
}