Repository navigation
Conversation
google-java-format 2.0.0 adds a cleanup pass that makes small non-whitespace changes, and enables it by default: removing redundant semicolons, empty annotation parentheses, and parentheses around a single untyped lambda parameter. Add a `cleanup` option to the googleJavaFormat step in the Gradle and Maven plugins to disable it. Older google-java-format versions don't have cleanups, so `cleanup(false)` has no effect with them. 2.0.0 also indents text block contents as part of the main formatting pass, even when long strings aren't reflowed, so update the expected output of the text block test. https://github.com/google/google-java-format/releases/tag/v2.0.0
4 of 5 tasks
Goooler
approved these changes
Oct 30, 2026
Co-authored-by: Zongle Wang <wangzongler@gmail.com>
On Java 17 the default google-java-format version is 1.28.0, which doesn't have cleanups and doesn't indent text block contents without reflowing long strings.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
google-java-format 2.0.0 (https://github.com/google/google-java-format/releases/tag/v2.0.0) adds a cleanup pass that makes small non-whitespace changes, and enables it by default: removing redundant semicolons, empty annotation parentheses (
@Foo()→@Foo), and parentheses around a single untyped lambda parameter ((x) -> ...→x -> ...).This PR bumps the default google-java-format version from 1.36.1 to 2.0.0, and adds a
cleanupoption to thegoogleJavaFormatstep to turn the cleanups off (googleJavaFormat().cleanup(false)in Gradle,<cleanup>false</cleanup>in Maven). Older google-java-format versions don't have cleanups, so the option has no effect with them.2.0.0 also indents text block contents as part of the main formatting pass, even when long strings aren't reflowed, so this updates the expected output of the text block test.
2.0.0 also restores
JavaFormatterOptions.Style.valueOf(String)(google/google-java-format#1478), which 1.37.0 removed and which Spotless uses (#3126).