google / google/google-java-format

not idempotent, slow convergence, and bad converged result

Open
#863 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
6.2k
Forks
937
Avg merge
6m
Merged PRs (30d)
3

Description

Tested release 1.15.0 with the following

```
public class Foo {

private static final String foo =
"\"aaaaaaaaaaaaaaaaaaaaa\":\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\","
+ "\"aaaaaaaaaaaaaaaaaaaaa\":\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\","
+ "\"aaaaaaaaaaaaaaaaaaaaa\":\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\","
+ "\"aaaaaaaaaaaaaaaaaaaaa\":\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\","
+ "\"aaaaaaaaaaaaaaaaaaaaa\":\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"aaaaaaaaaaaaaaaaaaaaa\":\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n";
}
```

google-java-format would join the last two lines of string and make the last line even longer. Continue invoking google-java-format would keep joining the last part until the whole string is on a single line.

Workaround:
1. remove the last `\n` stops this behavior
2. make the last line shorter than 100 chars stops this behavior

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.