forked from OSchip/llvm-project
clang-format: [Java] Improve annotation handling.
Before: @SuppressWarnings( value = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") public static int iiiiiiiiiiiiiiiiiiiiiiii; After: @SuppressWarnings(value = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") public static int iiiiiiiiiiiiiiiiiiiiiiii; llvm-svn: 220284
This commit is contained in:
parent
171eb8dbeb
commit
fd68191db4
|
@ -1817,6 +1817,8 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
|
||||||
return false;
|
return false;
|
||||||
if (Left.Tok.getObjCKeywordID() == tok::objc_interface)
|
if (Left.Tok.getObjCKeywordID() == tok::objc_interface)
|
||||||
return false;
|
return false;
|
||||||
|
if (Left.Type == TT_JavaAnnotation)
|
||||||
|
return true;
|
||||||
if (Right.Type == TT_StartOfName ||
|
if (Right.Type == TT_StartOfName ||
|
||||||
Right.Type == TT_FunctionDeclarationName || Right.is(tok::kw_operator))
|
Right.Type == TT_FunctionDeclarationName || Right.is(tok::kw_operator))
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -82,6 +82,8 @@ TEST_F(FormatTestJava, Annotations) {
|
||||||
"});");
|
"});");
|
||||||
|
|
||||||
verifyFormat("@Partial @Mock DataLoader loader;");
|
verifyFormat("@Partial @Mock DataLoader loader;");
|
||||||
|
verifyFormat("@SuppressWarnings(value = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n"
|
||||||
|
"public static int iiiiiiiiiiiiiiiiiiiiiiii;");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTestJava, Generics) {
|
TEST_F(FormatTestJava, Generics) {
|
||||||
|
|
Loading…
Reference in New Issue