if (Left.is(Keywords.kw_var))
return true;
} else if (Style.Language == FormatStyle::LK_Java) {
+ if (Left.is(tok::r_square) && Right.is(tok::l_brace))
+ return true;
if (Left.is(TT_LambdaArrow) || Right.is(TT_LambdaArrow))
return true;
if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren))
" }\n"
"}");
verifyFormat("enum SomeThing {\n"
- " ABC(new int[]{1, 2}),\n"
- " CDE(new int[]{2, 3});\n"
+ " ABC(new int[] {1, 2}),\n"
+ " CDE(new int[] {2, 3});\n"
" Something(int[] i) {\n"
" }\n"
"}");
"}");
}
+TEST_F(FormatTestJava, ArrayInitializers) {
+ verifyFormat("new int[] {1, 2, 3, 4};");
+ verifyFormat("new int[] {\n"
+ " 1, 2, 3, 4,\n"
+ "};");
+}
+
TEST_F(FormatTestJava, ThrowsDeclarations) {
verifyFormat("public void doSooooooooooooooooooooooooooomething()\n"
" throws LooooooooooooooooooooooooooooongException {\n}");