forked from OSchip/llvm-project
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:
parent
16b107e9f0
commit
c7d024ac53
|
@ -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;");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue