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

String Templates Formatting for """ Multi-Line is "not nice"

Open
#1,033 4 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
tooling

Research direction

Start with the multiline string-template example in web/ui/src/main/java/dev/enola/web/ui/ThingUI.java and review the JEP-430 support introduced by #981. Trace the formatter behavior for multiline templates, then add a regression test showing the desired interpolation layout and verify the formatted output.

Written by the indexing model from the issue text.

Description

#981 introduced JEP-430 / JEP-459 String Templates support.

This works great (~leaves it alone) for "single line", e.g. var html = STR."<table class=\"\{cssClass}\">";

However when exploring using this for """ Multi-Line it currently formats like this:

return STR."""
<table class="\{
        s(cssClass)}">
<tbody>

</tbody>
</table>
""";

To my eyes, that line break (as if it was a Builder type thing, presumably?) looks fairly "ugly"; I would expect it to simply look like this instead:

return STR."""
<table class="\{s(cssClass)}">
<tbody>

</tbody>
</table>
""";

Do folks agree?

@cushon

Dominant language
Java
Stars
6.2k
Forks
936
Avg merge
6m
Merged PRs (30d)
3

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.