google/google-java-format

Text block formatting bug in 1.25.0

protocol7 opened this issue · 3 comments

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