clang-format: [Java] Don't line-wrap before annotations' l_parens.

Before:
  @SomeAnnotation
  (aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa)
  int i;

After:
  @SomeAnnotation(
      aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa)
  int i;

llvm-svn: 225963
This commit is contained in:
Daniel Jasper
2015-01-14 09:51:32 +00:00
parent a831c58e53
commit 3e1bd1407b
2 changed files with 5 additions and 1 deletions

View File

@@ -1939,7 +1939,7 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
if (Left.Tok.getObjCKeywordID() == tok::objc_interface)
return false;
if (Left.isOneOf(TT_JavaAnnotation, TT_LeadingJavaAnnotation))
return true;
return !Right.is(tok::l_paren);
if (Right.isOneOf(TT_StartOfName, TT_FunctionDeclarationName) ||
Right.is(tok::kw_operator))
return true;

View File

@@ -279,6 +279,10 @@ TEST_F(FormatTestJava, Annotations) {
verifyFormat("@Test(a)\n"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa);");
verifyFormat("@SomeAnnotation(\n"
" aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa)\n"
"int i;",
getStyleWithColumns(50));
}
TEST_F(FormatTestJava, Generics) {