Skip to content

Conversation

timtebeek
Copy link
Member

timtebeek and others added 4 commits July 9, 2025 16:58
This recipe replaces inefficient string concatenation patterns like
`"" + ...` with `String.valueOf(...)`. This improves code readability
and may have minor performance benefits.

The recipe preserves parentheses when they exist in the original
expression, e.g., ("" + 42) becomes (String.valueOf(42)).

Fixes #628

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…ring types

- Use TypeUtils.isString() instead of comparing with JavaType.Primitive.String
- Update test expectation for comment preservation (known JavaTemplate limitation)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@timtebeek timtebeek requested a review from greg-at-moderne July 9, 2025 16:34
@timtebeek timtebeek self-assigned this Jul 9, 2025
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Jul 9, 2025
@timtebeek timtebeek marked this pull request as draft July 9, 2025 16:36
@timtebeek
Copy link
Member Author

timtebeek commented Jul 9, 2025

Seeing some perhaps undesirable effects:
image

@greg-at-moderne
Copy link
Contributor

Seeing some perhaps undesirable effects:

This might look a bit off as it violates the symmetry of the code text, but I think it's fine actually.

@greg-at-moderne greg-at-moderne removed their request for review July 31, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Recipe to avoid concatenating with empty String to perform type conversion
2 participants