Index: lib/Format/TokenAnnotator.cpp =================================================================== --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -1680,6 +1680,8 @@ Left.MatchingParen->Previous->is(tok::period)) // A.DoSomething(); return false; + if (Left.Type == TT_TemplateCloser && Right.is(tok::l_square)) + return false; return true; } Index: unittests/Format/FormatTestJava.cpp =================================================================== --- unittests/Format/FormatTestJava.cpp +++ unittests/Format/FormatTestJava.cpp @@ -217,6 +217,9 @@ verifyFormat("public static ArrayList get() {\n}"); verifyFormat(" T getInstance(Class type);"); verifyFormat("Function function;"); + + verifyFormat("private Foo[] foos;"); + verifyFormat("Foo[] foos = this.foos;"); } TEST_F(FormatTestJava, StringConcatenation) {