GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Join `"a " + "b"` string concatenations that end up on one line · Issue #148 · openjavaformat/open-java-format

Join "a " + "b" string concatenations that end up on one line #148

New issue
Copy link
New issue
Copy link
Closed
#176
Closed
Join "a " + "b" string concatenations that end up on one line#148
#176
Copy link
Labels
bugSomething isn't workingSomething isn't working

Description

@abashev
abashev
opened on Oct 23, 2026
Issue body actions

Upstream: palantir#1781
Kind: bug | Priority: low

palantir-java-format#1781 (closed unmerged on 2026-10-17) describes a leftover of string wrapping: when a long concatenation of literals is re-wrapped and the pieces end up on the same line, the + between two adjacent literals stays, because the string-wrapping pass only acts on lines that exceed the column limit. The PR adds a pass that merges runs of adjacent literals which already share a line into one literal, guarded so that it never merges across a comment (NON-NLS markers), never touches text blocks, and refuses merges that would change an octal escape such as "\1" + "2".

Why it matters to us: our StringWrapper has no such joining pass, so we should leave the same "..." + "..." residue and the formatting stays dependent on how the author wrapped the string. It also interacts with our open work on NON-NLS markers (our #23). The idea also changes the semantics-adjacent text of string literals, so the escape guard is the part to get right.

Affected files: open-java-format/src/main/java/com/palantir/javaformat/java/StringWrapper.java (including the fast-path checks that decide whether wrapping is needed).

Before (upstream behaviour before the change; our StringWrapper has no joining pass, not run):

throw new SafeIllegalArgumentException(
        "Invalid recipient field - contains multiple " + "foreign key properties.",
        UnsafeArg.of("field", maybeField));

After (with the change):

throw new SafeIllegalArgumentException(
        "Invalid recipient field - contains multiple foreign key properties.",
        UnsafeArg.of("field", maybeField));

Suggested action: investigate; adopt the idea only with the escape and comment guards, low priority.


Filed from an upstream-watch ticket after manual review.

Activity

  1. abashev
    added
    bugSomething isn't workingSomething isn't working
    on Oct 30, 2026
  2. abashev
    closed this as completedin da784aaon Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.