Skip to content

Text block formatting bug in 1.25.0 #1195

@protocol7

Description

@protocol7

In 1.25.0 we're seeing text block formatting failing in some cases, for example:

package com.helloworld;

class Foo {
  void foo() {
    var bar = """
        bar\
         bar""";
  }
}

java -jar google-java-format-1.25.0-all-deps.jar Foo.java gives:

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: ===
package com.helloworld;

class Foo {

    void foo() {
        /*missing*/ bar = "barbar";
    }
}
=== Expected: ===
package com.helloworld;

class Foo {

    void foo() {
        /*missing*/ bar = "bar bar";
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions