if (Current.is(TT_SelectorName) && State.Stack.back().ObjCSelectorNameFound &&
State.Stack.back().BreakBeforeParameter)
return true;
- if (Previous.ClosesTemplateDeclaration && Current.NestingLevel == 0 &&
- !Current.isTrailingComment())
- return true;
+ if (Current.NestingLevel == 0 && !Current.isTrailingComment()) {
+ if (Previous.ClosesTemplateDeclaration)
+ return true;
+ if (Previous.is(TT_LeadingJavaAnnotation) && Current.isNot(tok::l_paren))
+ return true;
+ }
// If the return type spans multiple lines, wrap before the function name.
if (Current.isOneOf(TT_FunctionDeclarationName ,tok::kw_operator) &&
return 0;
if (Style.Language == FormatStyle::LK_Java) {
- if (Left.is(TT_LeadingJavaAnnotation))
- return 1;
if (Right.isOneOf(Keywords.kw_extends, Keywords.kw_throws))
return 1;
if (Right.is(Keywords.kw_implements))
verifyFormat("@SomeAnnotation(\"With some really looooooooooooooong text\")\n"
"private static final long something = 0L;");
+ verifyFormat("@Mock\n"
+ "DataLoader loooooooooooooooooooooooader =\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;",
+ getStyleWithColumns(60));
}
TEST_F(FormatTestJava, Generics) {