Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect user's existing splits in string concatenations #192

Merged
merged 11 commits into from
Feb 13, 2020

Conversation

dansanduleac
Copy link
Contributor

@dansanduleac dansanduleac commented Feb 13, 2020

Before this PR

We'd split long string concatenations such that we'd end up with one item per line.
This breaks carefully crafted Sql statements in annotations or other places.

After this PR

==COMMIT_MSG==
Preserve the user's newlines in a long string concatenation (defined as a concatenation with + where at least one expression is a literal string).

Also allow inlining annotation values.
==COMMIT_MSG==

Possible downsides?

cc @sixinli

@changelog-app
Copy link

changelog-app bot commented Feb 13, 2020

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Preserve the user's newlines in a long string concatenation (defined as a concatenation with + where at least one expression is a literal string).

Check the box to generate changelog(s)

  • Generate changelog entry

@policy-bot policy-bot bot requested a review from fawind February 13, 2020 14:34
@dansanduleac dansanduleac requested review from ferozco and removed request for fawind February 13, 2020 14:34
}

private static final Pattern FORMAT_SPECIFIER = Pattern.compile("%|\\{[0-9]\\}");

private boolean isStringConcat(ExpressionTree first) {
final boolean[] stringConcat = {false};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, the poor man's AtomicBoolean 😂

@dansanduleac
Copy link
Contributor Author

🐞

@bulldozer-bot bulldozer-bot bot merged commit bab5f62 into develop Feb 13, 2020
@bulldozer-bot bulldozer-bot bot deleted the ds/string-splitting branch February 13, 2020 16:43
@svc-autorelease
Copy link
Collaborator

Released 0.3.24

@dansanduleac dansanduleac mentioned this pull request Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants