Skip to content

Text block formatting bug in 1.25.0 #1195

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

Activity

  1. ccmjga commented on Dec 6, 2024

    @ccmjga

    I'm having the same problem and hopefully it can be resolved soon.

  2. cushon commented on Dec 10, 2024

    @cushon
    Collaborator
  3. protocol7 commented on Dec 10, 2024

    @protocol7
    Author

    Thanks, can confirm that this indeed fixes the issue we noted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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