GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add --google-style to select Google Style by hferreiro · Pull Request #1415 · google/google-java-format

Conversation

@hferreiro

@hferreiro hferreiro commented Jul 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

--aosp was the only style switch, with no way to select Google style once it had been passed. Wrapper scripts such as Chromium's google-java-format launcher append --aosp unconditionally, leaving projects that format through them no way to opt back into Google Style.

Add a --google-style flag, and allow overriding a previously given style. When both --aosp and --google-style are given, the last one wins.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cushon

cushon commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Thanks, this looks fine.

One minor question: WDYT about --google-style or something like that instead of --no-aosp? I don't think we're expecting to add more styles here, and the behaviour would be the same, I just wonder if it's slightly clearer.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hferreiro
hferreiro force-pushed the no-aosp branch from 06a7113 to 5039d41 Compare September 2, 2026 12:37
@hferreiro hferreiro changed the title Add --no-aosp flag to select Google Style Add --style to select the formatting style Sep 2, 2026
@hferreiro

hferreiro commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Hey @cushon, what do you think about the latest update? I followed clang-format and added a --style= flag instead, while keeping --aosp for backwards compatibility.

I'll go with --google-style if that's preferred.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cushon

cushon commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Thanks, I think I slightly prefer --google-style over --style since it requires less refactoring, and I'm not expecting to add more styles. (If that happens I think there'd be a strong reason to generalize it to --style=.)

hferreiro reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hferreiro
hferreiro force-pushed the no-aosp branch from 5039d41 to 5ac3ec4 Compare September 16, 2026 12:58
@hferreiro hferreiro changed the title Add --style to select the formatting style Add --google-style to select Google Style Sep 16, 2026
@hferreiro

hferreiro commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, I think I slightly prefer --google-style over --style since it requires less refactoring, and I'm not expecting to add more styles. (If that happens I think there'd be a strong reason to generalize it to --style=.)

Done.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cushon
cushon approved these changes Sep 16, 2026
View reviewed changes
@copybara-service copybara-service Bot mentioned this pull request Sep 16, 2026
Add --google-style to select Google Style #1456
Closed
@hferreiro
Add --google-style to select Google Style
0d1c53e
--aosp was the only style switch, with no way to select Google Style once it had
been passed. Wrapper scripts such as Chromium's google-java-format launcher
append --aosp unconditionally, leaving projects that format through them no way
to opt back into Google Style.

Add a --google-style flag, and allow overriding a previously given style. When
both --aosp and --google-style are given, the last one wins.
@hferreiro
hferreiro force-pushed the no-aosp branch from 5ac3ec4 to 0d1c53e Compare September 16, 2026 13:07
@hferreiro

hferreiro commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

@cushon can you approve the workflow run?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

copybara-service Bot pushed a commit that referenced this pull request Sep 16, 2026
@hferreiro google-java-format Team
Add --google-style to select Google Style
0457d7c
--aosp was the only style switch, with no way to select Google style once it had been passed. Wrapper scripts such as Chromium's google-java-format launcher append --aosp unconditionally, leaving projects that format through them no way to opt back into Google Style.

Add a --google-style flag, and allow overriding a previously given style. When both --aosp and --google-style are given, the last one wins.

Fixes #1415

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1415 from hferreiro:no-aosp 0d1c53e
PiperOrigin-RevId: 982467851
copybara-service Bot pushed a commit that referenced this pull request Sep 16, 2026
@hferreiro google-java-format Team
Add --google-style to select Google Style
d325c79
--aosp was the only style switch, with no way to select Google style once it had been passed. Wrapper scripts such as Chromium's google-java-format launcher append --aosp unconditionally, leaving projects that format through them no way to opt back into Google Style.

Add a --google-style flag, and allow overriding a previously given style. When both --aosp and --google-style are given, the last one wins.

Fixes #1415

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1415 from hferreiro:no-aosp 0d1c53e
PiperOrigin-RevId: 982467851
copybara-service Bot pushed a commit that referenced this pull request Sep 16, 2026
@hferreiro google-java-format Team
Add --google-style to select Google Style
35a30df
--aosp was the only style switch, with no way to select Google style once it had been passed. Wrapper scripts such as Chromium's google-java-format launcher append --aosp unconditionally, leaving projects that format through them no way to opt back into Google Style.

Add a --google-style flag, and allow overriding a previously given style. When both --aosp and --google-style are given, the last one wins.

Fixes #1415

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1415 from hferreiro:no-aosp 0d1c53e
PiperOrigin-RevId: 982467851
@copybara-service copybara-service Bot mentioned this pull request Sep 16, 2026
Add --google-style to select Google Style #1457
Merged
@copybara-service copybara-service Bot closed this in 8165092 Sep 16, 2026
copybara-service Bot pushed a commit that referenced this pull request Sep 16, 2026
@hferreiro google-java-format Team
Add --google-style to select Google Style
24c2e5a
--aosp was the only style switch, with no way to select Google style once it had been passed. Wrapper scripts such as Chromium's google-java-format launcher append --aosp unconditionally, leaving projects that format through them no way to opt back into Google Style.

Add a --google-style flag, and allow overriding a previously given style. When both --aosp and --google-style are given, the last one wins.

Fixes #1415

FUTURE_COPYBARA_INTEGRATE_REVIEW=#1415 from hferreiro:no-aosp 0d1c53e
PiperOrigin-RevId: 982467851
@copybara-service copybara-service Bot mentioned this pull request Oct 1, 2026
Add --max-line-length and --style options, and programmatic tab support, to google-java-format. #1465
Merged
copybara-service Bot pushed a commit that referenced this pull request Oct 1, 2026
@cushon google-java-format Team
Add --max-line-length and --style options, and programmatic tab suppo…
6b86849
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cushon cushon cushon approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@hferreiro @cushon
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.