File tree Expand file tree Collapse file tree 2 files changed +9
-14
lines changed
google-java-format/src/main/java/com/cosium/code/format_gjf Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -100,9 +100,15 @@ The plugin allows you to tweak Google Java Format options :
100100 </dependencies >
101101 <configuration >
102102 <formatterOptions >
103+ <!-- Use AOSP style instead of Google Style (4-space indentation). -->
103104 <googleJavaFormat .aosp>false</googleJavaFormat .aosp>
105+ <!-- Format the javadoc -->
106+ <googleJavaFormat .formatJavadoc>true</googleJavaFormat .formatJavadoc>
107+ <!-- Fix import order and remove any unused imports, but do no other formatting. -->
104108 <googleJavaFormat .fixImportsOnly>false</googleJavaFormat .fixImportsOnly>
109+ <!-- Do not fix the import order. Unused imports will still be removed. -->
105110 <googleJavaFormat .skipSortingImports>false</googleJavaFormat .skipSortingImports>
111+ <!-- Do not remove unused imports. Imports will still be sorted. -->
106112 <googleJavaFormat .skipRemovingUnusedImports>false</googleJavaFormat .skipRemovingUnusedImports>
107113 </formatterOptions >
108114 </configuration >
@@ -111,19 +117,6 @@ The plugin allows you to tweak Google Java Format options :
111117</build >
112118```
113119
114- Documentation from the google-java-format CLI tool :
115-
116- ```
117- --aosp, -aosp, -a
118- Use AOSP style instead of Google Style (4-space indentation).
119- --fix-imports-only
120- Fix import order and remove any unused imports, but do no other formatting.
121- --skip-sorting-imports
122- Do not fix the import order. Unused imports will still be removed.
123- --skip-removing-unused-imports
124- Do not remove unused imports. Imports will still be sorted.
125- ```
126-
127120## JDK 16+ peculiarities
128121
129122Since google-java-format uses JDK internal apis, if you need to run the plugin with JDK 16+, you must pass some additional arguments to the JVM.
Original file line number Diff line number Diff line change 1212class GoogleJavaFormatterOptions {
1313
1414 private final JavaFormatterOptions .Style style ;
15+ private final boolean formatJavadoc ;
1516 private final boolean fixImportsOnly ;
1617 private final boolean skipSortingImports ;
1718 private final boolean skipRemovingUnusedImports ;
@@ -23,6 +24,7 @@ public GoogleJavaFormatterOptions(CodeFormatterConfiguration configuration) {
2324 } else {
2425 style = GOOGLE ;
2526 }
27+ formatJavadoc = configuration .getValue ("formatJavadoc" ).map (Boolean ::parseBoolean ).orElse (true );
2628 fixImportsOnly =
2729 configuration .getValue ("fixImportsOnly" ).map (Boolean ::parseBoolean ).orElse (false );
2830 skipSortingImports =
@@ -35,7 +37,7 @@ public GoogleJavaFormatterOptions(CodeFormatterConfiguration configuration) {
3537 }
3638
3739 public JavaFormatterOptions javaFormatterOptions () {
38- return JavaFormatterOptions .builder ().style (style ).build ();
40+ return JavaFormatterOptions .builder ().style (style ).formatJavadoc ( formatJavadoc ). build ();
3941 }
4042
4143 public boolean isFixImportsOnly () {
You can’t perform that action at this time.
0 commit comments