aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/FormatTestJava.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2018-10-19 16:19:52 +0000
committerHans Wennborg <hans@hanshq.net>2018-10-19 16:19:52 +0000
commit749c1b597a8f2f544d285e9cf5fe18552a3a0137 (patch)
tree55713c850278c3818867d75e09cbb7a8e2445786 /clang/unittests/Format/FormatTestJava.cpp
parentf6ec77b447987da116bfc84134c557e5f9714203 (diff)
downloadllvm-749c1b597a8f2f544d285e9cf5fe18552a3a0137.zip
llvm-749c1b597a8f2f544d285e9cf5fe18552a3a0137.tar.gz
llvm-749c1b597a8f2f544d285e9cf5fe18552a3a0137.tar.bz2
Java annotation declaration being handled correctly
Previously, Java annotation declarations (@interface AnnotationName) were being handled as ObjC interfaces. This caused the brace formatting to mess up, so that when you had a class with an interface defined in it, it would indent the final brace of the class. It used to format this class like so: class A { @interface B {} } But will now just skip the @interface and format it like so: class A { @interface B {} } Patch by Sam Maier! Differential Revision: https://reviews.llvm.org/D53434 llvm-svn: 344789
Diffstat (limited to 'clang/unittests/Format/FormatTestJava.cpp')
-rw-r--r--clang/unittests/Format/FormatTestJava.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp
index aee8a99..f12d7fb 100644
--- a/clang/unittests/Format/FormatTestJava.cpp
+++ b/clang/unittests/Format/FormatTestJava.cpp
@@ -155,6 +155,15 @@ TEST_F(FormatTestJava, ClassDeclarations) {
" 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) {