mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 01:07:04 +08:00
clang-format: [Java] Make annotation formatting more consistent.
Before:
DoSomething(new A() {
@Override public String toString() {
}
});
After:
DoSomething(new A() {
@Override
public String toString() {
}
});
llvm-svn: 220282
This commit is contained in:
@@ -1797,7 +1797,7 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
|
||||
return true;
|
||||
} else if (Style.Language == FormatStyle::LK_Java) {
|
||||
if (Left.Type == TT_JavaAnnotation && Right.isNot(tok::l_paren) &&
|
||||
Line.MightBeFunctionDecl)
|
||||
Line.Last->is(tok::l_brace))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,12 @@ TEST_F(FormatTestJava, Annotations) {
|
||||
verifyFormat("@SuppressWarnings(value = \"unchecked\")\n"
|
||||
"public void doSomething() {\n}");
|
||||
|
||||
verifyFormat("DoSomething(new A() {\n"
|
||||
" @Override\n"
|
||||
" public String toString() {\n"
|
||||
" }\n"
|
||||
"});");
|
||||
|
||||
verifyFormat("@Partial @Mock DataLoader loader;");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user