google / google/google-java-format

not idempotent, slow convergence, and bad converged result

Aperta
#863 1 commento 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
6.2k
Fork
937
Merge medio
6m
PR unite (30g)
3

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.