!State.Stack.back().AvoidBinPacking) ||
Previous.Type == TT_BinaryOperator)
State.Stack.back().BreakBeforeParameter = false;
- if (Previous.Type == TT_TemplateCloser && Current.NestingLevel == 0)
+ if ((Previous.Type == TT_TemplateCloser ||
+ Previous.Type == TT_JavaAnnotation) &&
+ Current.NestingLevel == 0)
State.Stack.back().BreakBeforeParameter = false;
if (NextNonComment->is(tok::question) ||
(PreviousNonComment && PreviousNonComment->is(tok::question)))
Left.Type == TT_InheritanceColon)
return 2;
+ if (Left.Type == TT_LeadingJavaAnnotation)
+ return 1;
+ if (Style.Language == FormatStyle::LK_Java && Right.TokenText == "implements")
+ return 2;
+
if (Right.isMemberAccess()) {
if (Left.is(tok::r_paren) && Left.MatchingParen &&
Left.MatchingParen->ParameterCount > 0)
return 150;
}
- if (Left.Type == TT_LeadingJavaAnnotation)
- return 1;
-
if (Right.Type == TT_TrailingAnnotation &&
(!Right.Next || Right.Next->isNot(tok::l_paren))) {
// Moving trailing annotations to the next line is fine for ObjC method
" implements SomeInterface,\n"
" AnotherInterface {}",
getStyleWithColumns(40));
+ verifyFormat("@SomeAnnotation()\n"
+ "abstract class aaaaaaaaaaaa extends bbbbbbbbbbbbbbb\n"
+ " implements cccccccccccc {\n"
+ "}",
+ getStyleWithColumns(76));
}
TEST_F(FormatTestJava, EnumDeclarations) {