IDEA-161026 Quickdoc badly shows initialization of array

This commit is contained in:
Dmitry Batrak
2016-09-21 11:43:27 +03:00
parent aadd111eda
commit c97e7f6f0d
4 changed files with 22 additions and 1 deletions
@@ -2175,7 +2175,20 @@ public class JavaDocInfoGenerator {
if (type != null) {
generateType(myBuffer, type, expression);
}
expression.acceptChildren(this);
PsiExpression[] dimensions = expression.getArrayDimensions();
if (dimensions.length > 0) {
LOG.assertTrue(myBuffer.charAt(myBuffer.length() - 1) == ']');
myBuffer.setLength(myBuffer.length() - 1);
for (PsiExpression dimension : dimensions) {
dimension.accept(this);
myBuffer.append(", ");
}
myBuffer.setLength(myBuffer.length() - 2);
myBuffer.append(']');
}
else {
expression.acceptChildren(this);
}
}
@Override
@@ -0,0 +1 @@
<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://A"><code>A</code></a></b></small><PRE>public static int[] <b>x = new int[1]</b></PRE></body></html>
@@ -0,0 +1,3 @@
class A {
public static int[] x = new int[1];
}
@@ -172,6 +172,10 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
doTestField();
}
public void testFieldInitializedWithSizedArray() throws Exception {
doTestField();
}
public void testEnumConstantOrdinal() throws Exception {
PsiClass psiClass = getTestClass();
PsiField field = psiClass.getFields() [0];