Index: lib/Format/TokenAnnotator.cpp =================================================================== --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -878,6 +878,7 @@ if (PreviousNotConst->Type == TT_TemplateCloser) return PreviousNotConst && PreviousNotConst->MatchingParen && PreviousNotConst->MatchingParen->Previous && + PreviousNotConst->MatchingParen->Previous->isNot(tok::period) && PreviousNotConst->MatchingParen->Previous->isNot(tok::kw_template); if (PreviousNotConst->is(tok::r_paren) && PreviousNotConst->MatchingParen && Index: unittests/Format/FormatTestJava.cpp =================================================================== --- unittests/Format/FormatTestJava.cpp +++ unittests/Format/FormatTestJava.cpp @@ -234,6 +234,13 @@ verifyFormat("private Foo[] foos;"); verifyFormat("Foo[] foos = this.foos;"); + + verifyFormat( + "SomeLoooooooooooooooooooooongType name =\n" + " SomeType.foo(someArgument)\n" + " .method()\n" + " .aaaaaaaaaaaaaaaaaaa()\n" + " .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();"); } TEST_F(FormatTestJava, StringConcatenation) {