summaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-11-10 16:30:02 +0000
committerNico Weber <nicolasweber@gmx.de>2014-11-10 16:30:02 +0000
commitae1c3ef1cf20df7c8d7828364d5f0412042604e8 (patch)
tree23cd268219faa4d93fe05a786e87f71c53a87b9e /unittests
parent8390f779282181f3ed90bff0f68681c46df35f1a (diff)
clang-format: [Java] Never treat @interface as annotation.
'@' followed by any keyword can't be an annotation, but @interface is currently the only combination of '@' and a keyword that's allowed, so limit it to this case. `@interface Foo` without a leading `public` was misformatted prior to this patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTestJava.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/unittests/Format/FormatTestJava.cpp b/unittests/Format/FormatTestJava.cpp
index c51566715d..44a7910e98 100644
--- a/unittests/Format/FormatTestJava.cpp
+++ b/unittests/Format/FormatTestJava.cpp
@@ -87,6 +87,22 @@ TEST_F(FormatTestJava, ClassDeclarations) {
" implements cccccccccccc {\n"
"}",
getStyleWithColumns(76));
+ verifyFormat("interface SomeInterface<A> extends Foo, Bar {\n"
+ " void doStuff(int theStuff);\n"
+ " void doMoreStuff(int moreStuff);\n"
+ "}");
+ verifyFormat("public interface SomeInterface {\n"
+ " void doStuff(int theStuff);\n"
+ " void doMoreStuff(int moreStuff);\n"
+ "}");
+ verifyFormat("@interface SomeInterface {\n"
+ " void doStuff(int theStuff);\n"
+ " void doMoreStuff(int moreStuff);\n"
+ "}");
+ verifyFormat("public @interface SomeInterface {\n"
+ " void doStuff(int theStuff);\n"
+ " void doMoreStuff(int moreStuff);\n"
+ "}");
}
TEST_F(FormatTestJava, EnumDeclarations) {