clang-format: [Java] Remove unnecessary line break after complex annotations

Before:
  @Annotation("Some"
      + " text")
  List<Integer>
      list;

After:
  @Annotation("Some"
      + " text")
  List<Integer> list;

llvm-svn: 258981
This commit is contained in:
Daniel Jasper 2016-01-27 20:14:23 +00:00
parent d36f7d5a9a
commit 15b01116d9
2 changed files with 4 additions and 0 deletions

View File

@ -151,6 +151,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
return true;
if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
(Previous.is(TT_TemplateCloser) && Current.is(TT_StartOfName) &&
Style.Language == FormatStyle::LK_Cpp &&
// FIXME: This is a temporary workaround for the case where clang-format
// sets BreakBeforeParameter to avoid bin packing and this creates a
// completely unnecessary line break after a template type that isn't

View File

@ -312,6 +312,9 @@ TEST_F(FormatTestJava, Annotations) {
" String bbbbbbbbbbbbbbb) {}\n"
"}",
getStyleWithColumns(60));
verifyFormat("@Annotation(\"Some\"\n"
" + \" text\")\n"
"List<Integer> list;");
}
TEST_F(FormatTestJava, Generics) {