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

Text block formatting bug in 1.25.1 #1205

Closed
protocol7 opened this issue Dec 11, 2024 · 0 comments · Fixed by #1207
Closed

Text block formatting bug in 1.25.1 #1205

protocol7 opened this issue Dec 11, 2024 · 0 comments · Fixed by #1207

Comments

@protocol7
Copy link

Similar to #1195, we're seeing gjf 1.25.1 failing on some specific text blocks:

public interface Foo {

  private static String foo =
      """
       foo\
       bar """;
}

Note the extra space at the end of the text block.

Fails with:

Foo.java:error: Something has gone terribly wrong. We planned to make the below formatting change, but have aborted because it would unexpectedly change the AST.
Please file a bug: https://github.com/google/google-java-format/issues/new

=== Actual: ===

public interface Foo {
    private static String foo = "foobar ";
}
=== Expected: ===

public interface Foo {
    private static String foo = "foobar";
}

copybara-service bot pushed a commit that referenced this issue Dec 11, 2024
Handle removing trailing whitespace when the closing delimiter is on the same
line as the final line of the text block.

Fixes #1205

PiperOrigin-RevId: 705210587
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 a pull request may close this issue.

1 participant