google-java-format: Reflow long strings does not give same output #2338
Open
Description
The following input
public class Test {
private String longString = "asdf asdf asdf asdf asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfa";
}
Becomes
public class Test {
private String longString =
"asdf asdf asdf asdf"
+ " asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfa";
}
Using google-java-format AOSP
When using the gradle task ./gradlew spotlessApply
this becomes
public class Test {
private String longString =
"asdf asdf asdf asdf"
+ " asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfa";
}
Gradle version: 8.10.2
Spotless version: 6.25.0 and 7.0.0.BETA4 (same result)
Operating system: macOS 15.0.1
Spotless config:
extensions.configure<com.diffplug.gradle.spotless.SpotlessExtension> {
java {
googleJavaFormat("1.24.0").aosp().reorderImports(true)
}
}