-
Notifications
You must be signed in to change notification settings - Fork 851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format type annotation as part of the type, not part of the modifiers list #653
Merged
Conversation
This file contains 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
… list Given e.g. `@Deprecated @nullable Object foo() {}`, prefer this: ``` @deprecated @nullable Object foo() {} ``` instead of: ``` @deprecated @nullable Object foo() {} ``` The implementation is complicated by the fact that the AST doesn't store source position information for modifiers, and there's no requirement that declaration annotations, modifiers, and type annotations appear in any particular order in source. To work around this, we examine the token stream to figure out the ordering of the modifiers and annotations. #5 Roll forward of 1a87579 without a use of a server-only Guava API. PiperOrigin-RevId: 392919024
copybara-service
bot
force-pushed
the
test_392785887
branch
from
August 25, 2021 16:55
81306b9
to
865cff0
Compare
gcf-merge-on-green bot
pushed a commit
to googleapis/google-oauth-java-client
that referenced
this pull request
Oct 26, 2021
…a-format to v1.12.0 (#763) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.googlejavaformat:google-java-format](https://github.com/google/google-java-format) | `1.7` -> `1.12.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/compatibility-slim/1.7)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/confidence-slim/1.7)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>google/google-java-format</summary> ### [`v1.12.0`](https://github.com/google/google-java-format/releases/v1.12.0) [Compare Source](https://github.com/google/google-java-format/compare/v1.11.0...v1.12.0) #### What's Changed - Format type annotation as part of the type, not part of the modifiers list ([google/google-java-format#653) - Fix indentation of case statements on JDK 17 ([google/google-java-format#654) **Full Changelog**: google/google-java-format@v1.11.0...v1.12.0 ### [`v1.11.0`](https://github.com/google/google-java-format/releases/v1.11.0) [Compare Source](https://github.com/google/google-java-format/compare/v1.10.0...v1.11.0) `google-java-format` now has improved support for running on JDK 17 early access builds. Changes: - Handle `final` variables in `instanceof` patterns ([#​588](https://github.com/google/google-java-format/issues/588)) - Fix handling of annotations in compact record constructors ([#​574](https://github.com/google/google-java-format/issues/574)) - Fix a crash in `instanceof` pattern handling ([#​594](https://github.com/google/google-java-format/issues/594)) - Wrap multiple values in switch expression case ([#​540](https://github.com/google/google-java-format/issues/540)) - Fix formatting of module trees after [JDK-8255464](https://bugs.openjdk.java.net/browse/JDK-8255464) - Support `sealed` classes ([#​603](https://github.com/google/google-java-format/issues/603)) ### [`v1.10.0`](https://github.com/google/google-java-format/releases/v1.10.0) `google-java-format` now supports running on JDK 16. The following flags are required when running on JDK 16, due to [JEP 396: Strongly Encapsulate JDK Internals by Default](https://openjdk.java.net/jeps/396): java \ --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \ -jar google-java-format-1.10.0-all-deps.jar T... Other changes: - Handle extra `;` in import lists (google/google-java-format@b769e81) - Add missing space between unary `-` and negative literals (google/google-java-format@6da736d) - Fix an off-by-one issue on the reflowing of string literals (google/google-java-format@b9fd8d2) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **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. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/google-oauth-java-client).
gcf-merge-on-green bot
pushed a commit
to googleapis/google-cloud-java
that referenced
this pull request
Nov 15, 2021
…a-format to v1.12.0 (#7719) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.googlejavaformat:google-java-format](https://github.com/google/google-java-format) | `1.11.0` -> `1.12.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/compatibility-slim/1.11.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/confidence-slim/1.11.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>google/google-java-format</summary> ### [`v1.12.0`](https://github.com/google/google-java-format/releases/v1.12.0) [Compare Source](https://github.com/google/google-java-format/compare/v1.11.0...v1.12.0) ##### What's Changed - Format type annotation as part of the type, not part of the modifiers list ([google/google-java-format#653) - Fix indentation of case statements on JDK 17 ([google/google-java-format#654) **Full Changelog**: google/google-java-format@v1.11.0...v1.12.0 </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **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. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/google-cloud-java).
gcf-merge-on-green bot
pushed a commit
to googleapis/google-auth-library-java
that referenced
this pull request
Nov 17, 2021
) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.googlejavaformat:google-java-format](https://github.com/google/google-java-format) | `1.7` -> `1.12.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/compatibility-slim/1.7)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/confidence-slim/1.7)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>google/google-java-format</summary> ### [`v1.12.0`](https://github.com/google/google-java-format/releases/v1.12.0) [Compare Source](https://github.com/google/google-java-format/compare/v1.11.0...v1.12.0) ##### What's Changed - Format type annotation as part of the type, not part of the modifiers list ([google/google-java-format#653) - Fix indentation of case statements on JDK 17 ([google/google-java-format#654) **Full Changelog**: google/google-java-format@v1.11.0...v1.12.0 ### [`v1.11.0`](https://github.com/google/google-java-format/releases/v1.11.0) [Compare Source](https://github.com/google/google-java-format/compare/v1.10.0...v1.11.0) `google-java-format` now has improved support for running on JDK 17 early access builds. Changes: - Handle `final` variables in `instanceof` patterns ([#​588](https://github.com/google/google-java-format/issues/588)) - Fix handling of annotations in compact record constructors ([#​574](https://github.com/google/google-java-format/issues/574)) - Fix a crash in `instanceof` pattern handling ([#​594](https://github.com/google/google-java-format/issues/594)) - Wrap multiple values in switch expression case ([#​540](https://github.com/google/google-java-format/issues/540)) - Fix formatting of module trees after [JDK-8255464](https://bugs.openjdk.java.net/browse/JDK-8255464) - Support `sealed` classes ([#​603](https://github.com/google/google-java-format/issues/603)) ### [`v1.10.0`](https://github.com/google/google-java-format/releases/v1.10.0) `google-java-format` now supports running on JDK 16. The following flags are required when running on JDK 16, due to [JEP 396: Strongly Encapsulate JDK Internals by Default](https://openjdk.java.net/jeps/396): java \ --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \ -jar google-java-format-1.10.0-all-deps.jar T... Other changes: - Handle extra `;` in import lists (google/google-java-format@b769e81) - Add missing space between unary `-` and negative literals (google/google-java-format@6da736d) - Fix an off-by-one issue on the reflowing of string literals (google/google-java-format@b9fd8d2) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/google-auth-library-java).
gcf-merge-on-green bot
pushed a commit
to googleapis/google-http-java-client
that referenced
this pull request
Nov 17, 2021
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.googlejavaformat:google-java-format](https://github.com/google/google-java-format) | `1.7` -> `1.12.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/compatibility-slim/1.7)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.googlejavaformat:google-java-format/1.12.0/confidence-slim/1.7)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>google/google-java-format</summary> ### [`v1.12.0`](https://github.com/google/google-java-format/releases/v1.12.0) [Compare Source](https://github.com/google/google-java-format/compare/v1.11.0...v1.12.0) ##### What's Changed - Format type annotation as part of the type, not part of the modifiers list ([google/google-java-format#653) - Fix indentation of case statements on JDK 17 ([google/google-java-format#654) **Full Changelog**: google/google-java-format@v1.11.0...v1.12.0 ### [`v1.11.0`](https://github.com/google/google-java-format/releases/v1.11.0) [Compare Source](https://github.com/google/google-java-format/compare/v1.10.0...v1.11.0) `google-java-format` now has improved support for running on JDK 17 early access builds. Changes: - Handle `final` variables in `instanceof` patterns ([#​588](https://github.com/google/google-java-format/issues/588)) - Fix handling of annotations in compact record constructors ([#​574](https://github.com/google/google-java-format/issues/574)) - Fix a crash in `instanceof` pattern handling ([#​594](https://github.com/google/google-java-format/issues/594)) - Wrap multiple values in switch expression case ([#​540](https://github.com/google/google-java-format/issues/540)) - Fix formatting of module trees after [JDK-8255464](https://bugs.openjdk.java.net/browse/JDK-8255464) - Support `sealed` classes ([#​603](https://github.com/google/google-java-format/issues/603)) ### [`v1.10.0`](https://github.com/google/google-java-format/releases/v1.10.0) `google-java-format` now supports running on JDK 16. The following flags are required when running on JDK 16, due to [JEP 396: Strongly Encapsulate JDK Internals by Default](https://openjdk.java.net/jeps/396): java \ --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \ -jar google-java-format-1.10.0-all-deps.jar T... Other changes: - Handle extra `;` in import lists (google/google-java-format@b769e81) - Add missing space between unary `-` and negative literals (google/google-java-format@6da736d) - Fix an off-by-one issue on the reflowing of string literals (google/google-java-format@b9fd8d2) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **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. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/google-http-java-client).
copybara-service bot
pushed a commit
that referenced
this pull request
Feb 4, 2022
Since the last plugin update was almost half a year ago, I thought it would be prudent to update it and resolve most of the issues regarding updating the plugin. It took around half an hour once I managed to correctly set up the module due to the gradle plugin version 1.2.1 + intellij version 2020.3 requiring java 11 to develop. All of the included annotation changes were requested by IntelliJ to add since the overrides added them as well. The change of `<? extends TextRange>` to `<TextRange>` was to resolve the syntax errors introduced by a change removing the wildcard requirement. NotificationGroup was deprecated and moved into the plugin xml file as per the SDK docs The same was required for `StdFileTypes.JAVA` being deprecated with the fix being `JavaFileType.INSTANCE` + changing the depend module to add that fix. I had to change the project SDK to JDK 11 on my end to have the gradle build work. I also tested the plugin with 1.12 and 1.10 on some test files such as from #653 and #654. Would be good to have some double checking though because I've had issues trying to get the test file reformatted in #558 working. Probably because it's locked behind an experimental flag? Fixes #688 COPYBARA_INTEGRATE_REVIEW=#688 from ze:idea-1.12.0 53f216c PiperOrigin-RevId: 426491735
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.
Format type annotation as part of the type, not part of the modifiers list
Given e.g.
@Deprecated @Nullable Object foo() {}
, prefer this:instead of:
The implementation is complicated by the fact that the AST doesn't store source position information for modifiers, and there's no requirement that declaration annotations, modifiers, and type annotations appear in any particular order in source.
To work around this, we examine the token stream to figure out the ordering of the modifiers and annotations.
#5
Roll forward of 1a87579 without a use of a server-only Guava API.