forked from OSchip/llvm-project
clang-format: [Java] Improve generic return type formatting.
Before: public<R> ArrayList<R> get() { After: public <R> ArrayList<R> get() { llvm-svn: 221979
This commit is contained in:
parent
30a2406e65
commit
09f6abe8d8
|
@ -1684,7 +1684,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
|
|||
} else if (Style.Language == FormatStyle::LK_Java) {
|
||||
if (Left.is(Keywords.kw_synchronized) && Right.is(tok::l_paren))
|
||||
return Style.SpaceBeforeParens != FormatStyle::SBPO_Never;
|
||||
if (Left.is(tok::kw_static) && Right.Type == TT_TemplateOpener)
|
||||
if (Left.isOneOf(tok::kw_static, tok::kw_public) &&
|
||||
Right.Type == TT_TemplateOpener)
|
||||
return true;
|
||||
}
|
||||
if (Right.Tok.getIdentifierInfo() && Left.Tok.getIdentifierInfo())
|
||||
|
|
|
@ -205,6 +205,7 @@ TEST_F(FormatTestJava, Generics) {
|
|||
verifyFormat("@Override\n"
|
||||
"public Map<String, ?> getAll() {\n}");
|
||||
|
||||
verifyFormat("public <R> ArrayList<R> get() {\n}");
|
||||
verifyFormat("public static <R> ArrayList<R> get() {\n}");
|
||||
verifyFormat("<T extends B> T getInstance(Class<T> type);");
|
||||
verifyFormat("Function<F, ? extends T> function;");
|
||||
|
|
Loading…
Reference in New Issue