Skip to content

Make SnippetFormatter whitespace-only. - #1517

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_1010462527
Nov 1, 2026
Merged

copybara-service[bot] merged 1 commit into
masterfrom
test_1010462527

Conversation

@copybara-service

Copy link
Copy Markdown

Make SnippetFormatter whitespace-only.

SnippetFormatter converts the formatted snippet back into replacements under the assumption that only whitespace changed, and throws IllegalArgumentException otherwise. Since 2.0.0 enabled cleanups by default, snippets that contain e.g. (x) -> x, @Foo(), or redundant semicolons hit that check, and the Eclipse plugin (which catches the exception) silently skips formatting. Snippets that needed modifier reordering already failed the same way.

Always disable cleanups and modifier reordering in SnippetFormatter, since it can only apply whitespace changes.

`SnippetFormatter` converts the formatted snippet back into replacements under the assumption that only whitespace changed, and throws `IllegalArgumentException` otherwise. Since 2.0.0 enabled cleanups by default, snippets that contain e.g. `(x) -> x`, `@Foo()`, or redundant semicolons hit that check, and the Eclipse plugin (which catches the exception) silently skips formatting. Snippets that needed modifier reordering already failed the same way.

Always disable cleanups and modifier reordering in `SnippetFormatter`, since it can only apply whitespace changes.

PiperOrigin-RevId: 1011550252
@copybara-service
copybara-service Bot merged commit 26b9db1 into master Nov 1, 2026
4 checks passed
@copybara-service
copybara-service Bot deleted the test_1010462527 branch November 1, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant