[PATCH] D53434: Java annotation declaration being handled correctly

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 19 09:22:47 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL344789: Java annotation declaration being handled correctly (authored by hans, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53434?vs=170197&id=170210#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53434

Files:
  cfe/trunk/lib/Format/UnwrappedLineParser.cpp
  cfe/trunk/unittests/Format/FormatTestJava.cpp


Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
===================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp
@@ -1130,6 +1130,10 @@
         nextToken();
         parseBracedList();
         break;
+      } else if (Style.Language == FormatStyle::LK_Java &&
+                 FormatTok->is(Keywords.kw_interface)) {
+        nextToken();
+        break;
       }
       switch (FormatTok->Tok.getObjCKeywordID()) {
       case tok::objc_public:
Index: cfe/trunk/unittests/Format/FormatTestJava.cpp
===================================================================
--- cfe/trunk/unittests/Format/FormatTestJava.cpp
+++ cfe/trunk/unittests/Format/FormatTestJava.cpp
@@ -155,6 +155,15 @@
                "  void doStuff(int theStuff);\n"
                "  void doMoreStuff(int moreStuff);\n"
                "}");
+  verifyFormat("class A {\n"
+               "  public @interface SomeInterface {\n"
+               "    int stuff;\n"
+               "    void doMoreStuff(int moreStuff);\n"
+               "  }\n"
+               "}");
+  verifyFormat("class A {\n"
+               "  public @interface SomeInterface {}\n"
+               "}");
 }
 
 TEST_F(FormatTestJava, AnonymousClasses) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53434.170210.patch
Type: text/x-patch
Size: 1305 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181019/fd04bedf/attachment.bin>


More information about the cfe-commits mailing list