clang-format: [Java] Fix space in generic method calls.
authorDaniel Jasper <djasper@google.com>
Tue, 21 Oct 2014 11:13:31 +0000 (11:13 +0000)
committerDaniel Jasper <djasper@google.com>
Tue, 21 Oct 2014 11:13:31 +0000 (11:13 +0000)
Before:
  A.<B>doSomething();

After:
  A.<B>doSomething();

llvm-svn: 220285

clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTestJava.cpp

index 9adec61..4b39b50 100644 (file)
@@ -1628,6 +1628,11 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
     return false;
   if (Right.is(tok::hash) && Left.is(tok::identifier) && Left.TokenText == "L")
     return false;
+  if (Left.Type == TT_TemplateCloser && Left.MatchingParen &&
+      Left.MatchingParen->Previous &&
+      Left.MatchingParen->Previous->is(tok::period))
+    // A.<B>DoSomething();
+    return false;
   return true;
 }
 
index afc13cf..f7d85fc 100644 (file)
@@ -90,6 +90,8 @@ TEST_F(FormatTestJava, Generics) {
   verifyFormat("Iterable<?> a;");
   verifyFormat("Iterable<?> a;");
   verifyFormat("Iterable<? extends SomeObject> a;");
+
+  verifyFormat("A.<B>doSomething();");
 }
 
 } // end namespace tooling