Skip to content

Text block formatting bug in 1.25.1 #1205

Closed
@protocol7

Description

@protocol7

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";
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions