palantir-java-format icon indicating copy to clipboard operation
palantir-java-format copied to clipboard

Join string concatenations if they end up on the same line

Open dansanduleac opened this issue 4 years ago • 0 comments

What happened?

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

gets turned into

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

but the + is left behind.

What did you want to happen?

There should be a single string literal and no +.

Implementation wise, my intuition is that we should rewrap string concatenations that end up being moved in normal formatting, which will achieve this. Currently, StringWrapper.wrap will bail out if there are no overly long lines.

dansanduleac avatar Nov 12 '19 16:11 dansanduleac