Skip to content

Add --max-line-length and --style options, and programmatic tab support, to google-java-format. - #1465

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_989464783
Oct 1, 2026
Merged

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

Conversation

@copybara-service

Copy link
Copy Markdown

Add --max-line-length and --style options, and programmatic tab support, to google-java-format.

This adds support for configurable code styles to google-java-format, including:

  • --max-line-length: configures the column limit (default 100).
  • --style=google|aosp: selects the code style, preserving any configured line length or tab settings. If multiple style options are given, the last one wins.
  • JavaFormatterOptions.Style.Builder.useTabs(boolean): programmatic support for tab-based indentation.

Related issues:

…rt, to google-java-format.

This adds support for configurable code styles to google-java-format, including:
- `--max-line-length`: configures the column limit (default 100).
- `--style=google|aosp`: selects the code style, preserving any configured line length or tab settings. If multiple style options are given, the last one wins.
- `JavaFormatterOptions.Style.Builder.useTabs(boolean)`: programmatic support for tab-based indentation.

Related issues:

* Line lengths: #425
* Tab-based indents: #1320
* `--style=` flag: #1415

PiperOrigin-RevId: 991524639
@copybara-service
copybara-service Bot merged commit 6b86849 into master Oct 1, 2026
4 checks passed
@copybara-service
copybara-service Bot deleted the test_989464783 branch October 1, 2026 09:12
@mkurz

mkurz commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Added the CLI counterpart here

Comment on lines -40 to +43
public enum Style {
/** Code style configuration for layout and imports. */
@Immutable
public record Style(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a breaking change. See diffplug/spotless#3126

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

3 participants