You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-7Lines changed: 6 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,7 @@ For available versions see [releases](https://github.com/sbt/sbt-java-formatter/
38
38
* The `javafmtRemoveUnusedImports` setting controls whether unused imports are removed (`true` by default).
39
39
* The `javafmtReflowLongStrings` setting controls whether long string literals are reflowed (`true` by default).
40
40
* The `javafmtFormatJavadoc` setting controls whether Javadoc comments are reformatted (`true` by default).
41
+
* The `javafmtReorderModifiers` setting controls whether modifiers are reordered into JLS order (`true` by default). Disabling it requires `javafmtFormatterCompatibleJavaVersion := 21`.
41
42
* The `javafmtFormatterCompatibleJavaVersion` setting selects which `google-java-format` runtime line to use (`21` by default).
42
43
* The `javafmtJavaMaxHeap` setting controls the maximum heap passed to the forked `google-java-format` JVM (`Some("256m")` by default).
> Many projects use Java 17 as their baseline today. If that is true for your build, `ThisBuild / javafmtFormatterCompatibleJavaVersion := 17` is often the simplest setup.
87
88
>
88
-
> The main Java language support changes in `google-java-format`[after `v1.28.0`](https://github.com/google/google-java-format/compare/v1.28.0...v1.35.0) are:
89
+
> The main Java language support changes in `google-java-format`[after `v1.28.0`](https://github.com/google/google-java-format/compare/v1.28.0...v1.36.0) are:
89
90
>
90
91
> -[Initial support for import module in google-java-format](https://github.com/google/google-java-format/commit/6afe380707ec16884ec2761763ccec998de403d1)
91
92
> -[Support Instance Main Methods in google-java-format](https://github.com/google/google-java-format/commit/737b0032b3a18eb6e458271ea440098c166f6c2d)
93
+
> -[Initial support for Markdown documentation comments (`///`)](https://github.com/google/google-java-format/commit/53e2a763436abf00268f25ab59e481ca1d99cd29)
92
94
>
93
95
> If you do not use these language features, setting `ThisBuild / javafmtFormatterCompatibleJavaVersion := 17` lets sbt-java-formatter work out of the box on CI servers and developer machines that run sbt on Java 17.
- or point the formatter to a newer JDK via `SBT_JAVAFMT_JAVA_HOME` or `-Dsbt-javafmt.java.home=...`
131
134
132
-
`javafmtOptions` is still available for compatibility, but the preferred sbt-facing configuration is through the dedicated `javafmt...` settings above.
133
-
134
-
`JavaFormatterOptions.reorderModifiers()` currently has no effect in this plugin.
135
-
136
-
The plugin now runs `google-java-format` via its CLI in a forked JVM, and the released `google-java-format` CLI used here [does not yet support a corresponding `--skip-reordering-modifiers` flag](https://github.com/google/google-java-format/pull/1373).
135
+
`javafmtOptions` is still available for compatibility with upstream `JavaFormatterOptions`, but the preferred sbt-facing configuration is through the dedicated `javafmt...` settings above.
137
136
138
137
If you want to tweak the format, take a minute to consider whether it is really worth it, and have a look at the motivations in the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html).
139
138
If you decide you really need more flexibility, you could consider other plugins such as the [sbt-checkstyle-plugin](https://github.com/etsy/sbt-checkstyle-plugin)
"Compatibility setting for upstream JavaFormatterOptions. Prefer the dedicated javafmt... settings; reorderModifiers() currently has no effect with the released google-java-format CLI used by this plugin.")
88
+
"Compatibility setting for upstream JavaFormatterOptions. Prefer the dedicated javafmt... settings where available.")
0 commit comments