diff --git a/java/java-impl/src/com/intellij/codeInsight/lookup/PsiTypeLookupItem.java b/java/java-impl/src/com/intellij/codeInsight/lookup/PsiTypeLookupItem.java index b1672bd395f3..1ba18d7f49ce 100644 --- a/java/java-impl/src/com/intellij/codeInsight/lookup/PsiTypeLookupItem.java +++ b/java/java-impl/src/com/intellij/codeInsight/lookup/PsiTypeLookupItem.java @@ -226,7 +226,7 @@ public class PsiTypeLookupItem extends LookupItem { } if (myBracketsCount > 0) { - presentation.setTailText(StringUtil.repeat("[]", myBracketsCount) + presentation.getTailText(), true); + presentation.setTailText(StringUtil.repeat("[]", myBracketsCount) + StringUtil.notNullize(presentation.getTailText()), true); } } diff --git a/java/java-tests/testData/codeInsight/completion/smartType/NewByteArray.java b/java/java-tests/testData/codeInsight/completion/smartType/NewByteArray.java new file mode 100644 index 000000000000..f0cdb7199549 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/NewByteArray.java @@ -0,0 +1,5 @@ +class A { + byte[] m() { + return new x; + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java index 22e8b463b992..9d8703dca517 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java @@ -612,6 +612,13 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase { assertEquals("[] (java.lang)", LookupElementPresentation.renderElement(myItems[1]).getTailText()); } + public void testNewByteArray() { + configureByTestName(); + assertStringItems("byte"); + assertEquals("[]", LookupElementPresentation.renderElement(myItems[0]).getTailText()); + + } + public void testInsideStringLiteral() throws Throwable { doAntiTest(); } public void testDefaultAnnoParam() throws Throwable { doTest(); }