Skip to content
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
merged 1 commit into from Aug 25, 2021

Commits on Aug 25, 2021

  1. Format type annotation as part of the type, not part of the modifiers…

    … 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
    cushon authored and google-java-format Team committed Aug 25, 2021
    Copy the full SHA
    865cff0 View commit details
    Browse the repository at this point in the history