clang-format: Tweak -style=Chromium for Java files.
For Java, don't do any of the deviations from Google Style that Chromium style
does for C++.
Chromium's Java follows Android Java style [1], which is roughly Google Java
style with an indent of 4 and a continuation indent of 8.
1: https://source.android.com/source/code-style.html
llvm-svn: 222839
diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp
index b99dec7..10149f5 100644
--- a/clang/unittests/Format/FormatTestJava.cpp
+++ b/clang/unittests/Format/FormatTestJava.cpp
@@ -69,6 +69,21 @@
Style);
}
+TEST_F(FormatTestJava, Chromium) {
+ verifyFormat("class SomeClass {\n"
+ " void f() {}\n"
+ " int g() {\n"
+ " return 0;\n"
+ " }\n"
+ " void h() {\n"
+ " while (true) f();\n"
+ " for (;;) f();\n"
+ " if (true) f();\n"
+ " }\n"
+ "}",
+ getChromiumStyle(FormatStyle::LK_Java));
+}
+
TEST_F(FormatTestJava, ClassKeyword) {
verifyFormat("SomeClass.class.getName();");
verifyFormat("Class c = SomeClass.class;");