Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

String splitting / wrapping can increase line length

Open
#989 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
tooling

Research direction

Reproduce the report with the Java input and output shown in the issue using google-java-format 1.18.1. Trace the formatter’s string-literal splitting logic and its line-length tests; done means long literals are not made longer by wrapping and existing formatting behavior remains covered by tests.

Written by the indexing model from the issue text.

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
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:

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");
  }
}
Dominant language
Java
Stars
6.2k
Forks
936
Avg merge
6m
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/google-java-format

All issues in google/google-java-format

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.