Repository navigation
Update dependency com.google.googlejavaformat:google-java-format to v2 - #5974
renovate-bot wants to merge 1 commit into
Conversation
orca-review-bot
left a comment
There was a problem hiding this comment.
Formatter-only bump with no runtime, BOM or packaging impact. The catch is that 2.0.0 reformats a lot of existing code, and spotlessJavaCheck now fails in 45 modules. Every other CI job passes. This needs a repo-wide spotlessApply commit before it can merge, ideally on its own and listed in a new .git-blame-ignore-revs. It also needs a deliberate call on 2.0's default cleanup edits. No CHANGELOG or docs changes needed.
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
| errorprone = { module = "com.google.errorprone:error_prone_core", version = "2.50.0" } # required by the polaris-java plugin | ||
| google-cloud-iamcredentials = { module = "com.google.cloud:google-cloud-iamcredentials", version = "2.100.0" } | ||
| google-java-format = { module = "com.google.googlejavaformat:google-java-format", version = "1.36.1" } # required by the polaris-spotless plugin | ||
| google-java-format = { module = "com.google.googlejavaformat:google-java-format", version = "2.0.0" } # required by the polaris-spotless plugin |
There was a problem hiding this comment.
2.0.0 formats code differently from 1.36.1, and nothing else in the repo changed with it. So spotlessJavaCheck fails in 45 modules right now. Can we push a separate commit with the ./gradlew spotlessApply output? It would also help to add a .git-blame-ignore-revs entry for that commit. Otherwise, can we close this and have a maintainer do the bump together with the reformat?
🤖 AI-generated review comment — agents make mistakes, so please verify before acting on it.
There was a problem hiding this comment.
We will need a PR to format it with the new version.
e0888da to
b987dee
Compare
b987dee to
3b9d57e
Compare
This PR contains the following updates:
1.36.1→2.0.0Release Notes
google/google-java-format (com.google.googlejavaformat:google-java-format)
v2.0.0google-java-format 2.0.0 replaces the formatter's layout engine, and makes some improvements to lambda formatting (#19). This release also adds an optional cleanup pass that makes small non-whitespace changes, which is enabled by default.
Because of these changes, 2.0.0 reformats more existing code than a typical release. We recommend reformatting your codebase in a single commit when upgrading.
Formatting changes
A lambda that is the only argument of a call is now kept on the same line as the call, instead of starting on a new line with an extra level of indentation (#19):
Text blocks are now indented as part of the main formatting pass, so their indentation is correct even with
--skip-reflowing-long-strings.Fixed indentation of comments after
assert, enum constants,forinitializers,tryresources, multi-catch clauses, and type arguments.Cleanups
Added a
--cleanupflag, enabled by default, for small non-whitespace changes:@Foo()→@Foo)(x) -> ...→x -> ...) (#762)Cleanups only apply to the ranges being formatted. Use
--cleanup=falseto only change whitespace (and the existing--skip-sorting-imports,--skip-removing-unused-imports, and--skip-reordering-modifiersflags for the other non-whitespace changes).When formatting a range with
--linesor--offsetand cleanups enabled, unformatted statements outside the range are re-indented to match the formatted output, so an edit that adds or removes a level of nesting doesn't leave the surrounding code misaligned. Blank lines left behind by cleanups are removed.Configuration
--max-line-length=Nsets the column limit (default 100) (#425). (This flag was introduced in v1.37.0)Language support
Javadoc
*/(#67).<pre>{@code ...}blocks without leading*.Long strings
--linesor--offset, only long string literals in the requested range are reflowed (#1114).\\tin a Windows path or a regular expression) are no longer split when reflowing long string literals (#1186, #1253, #1439).Other fixes
NoClassDefFoundErrorsince 1.36.0 because the plugin didn't bundlecommonmark(#1428).--dry-runwith--replacenow names the right flag (#1094).API changes
JavaFormatterOptions.Builder.cleanup(boolean)controls the new cleanup pass, and defaults totrue. This meansFormatter.formatSourcenow makes the non-whitespace changes listed above by default. Integrations that format code the user is editing, e.g. format-on-save in an IDE, should setcleanup(false); the IntelliJ plugin does this.Formatter.getFormatReplacementsis now strictly whitespace-only: it no longer reorders modifiers, and never applies cleanups. UseFormatter.formatSource(String, Collection<Range<Integer>>)to format character ranges with modifier reordering.JavaFormatterOptions.Stylebecame a record in 1.37.0. The enum-compatible methods, such asStyle.valueOf(String), have been restored for tools like Spotless that called them (#1478).com.google.googlejavaformat.Doc,OpsBuilder, and related types) are no longer used to format Java, but are still included for other formatters that build on them.Full Changelog: google/google-java-format@v1.37.0...v2.0.0
v1.37.0Changes:
--max-line-lengthflag (#425)c51d691,ecba4fb)--google-styleand--style=google|aospflags for easier switching between Google and AOSP style (#1415)Full Changelog: google/google-java-format@v1.36.1...v1.37.0
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.