google / google/google-java-format

String splitting / wrapping can increase line length

Open
#989 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6.2k
Forks
937
Avg merge
6m
Merged PRs (30d)
3

Description

### Version
1.18.1, all-deps JAR

### Description
In some cases Google Java Format wraps / splits long string literals which exceed the maximum line length in a way which makes the string literal exceed the maximum line length even further.

In those cases maybe it would be better if the string had not been split / wrapped.

### Example
```java
class Test {
void test() {
System.out.println(
"\nSee https://example.com/some-really-long-path-which-exceeds-the-maximum-line-length-of-the-formatter");
}
}
```

The formatted result is:
```java
class Test {
void test() {
System.out.println(
"\n"
+ "See https://example.com/some-really-long-path-which-exceeds-the-maximum-line-length-of-the-formatter");
}
}
```

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.