google-java-format: Reflow long strings does not give same output
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- build-system, tooling
Research direction
Reproduce the discrepancy with ./gradlew spotlessApply using google-java-format 1.24.0 in AOSP mode and the shown Spotless configuration. Compare its output with direct google-java-format output for the long-string example; done means both produce the same indentation and formatting.
Written by the indexing model from the issue text.
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)
}
}
- Dominant language
- Java
- Stars
- 5.7k
- Forks
- 560
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 43
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from diffplug/spotless
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 66/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
All issues in diffplug/spotless
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
area/frontend
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100