Skip to content

Commit

Permalink
clang-format: [Java] Fix more generics formatting.
Browse files Browse the repository at this point in the history
Before:
  < T extends B > T getInstance(Class<T> type);

After:
  <T extends B> T getInstance(Class<T> type);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221124 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
djasper-gh committed Nov 3, 2014
1 parent 03bea98 commit 6ee86df
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Format/TokenAnnotator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ class AnnotatingParser {
return false;
break;
case tok::less:
if (Tok->Previous && !Tok->Previous->Tok.isLiteral() && parseAngle())
if ((!Tok->Previous || !Tok->Previous->Tok.isLiteral()) && parseAngle())
Tok->Type = TT_TemplateOpener;
else {
Tok->Type = TT_BinaryOperator;
Expand Down
1 change: 1 addition & 0 deletions unittests/Format/FormatTestJava.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ TEST_F(FormatTestJava, Generics) {
"public Map<String, ?> getAll() {\n}");

verifyFormat("public static <R> ArrayList<R> get() {\n}");
verifyFormat("<T extends B> T getInstance(Class<T> type);");
}

TEST_F(FormatTestJava, StringConcatenation) {
Expand Down

0 comments on commit 6ee86df

Please sign in to comment.