Skip to content

Fix JavaTemplate replacements passing a J.NewArray into a vararg J.MethodInvocation#6572

Merged
timtebeek merged 4 commits intomainfrom
fix-varargs-replacement-with-template
Jan 20, 2026
Merged

Fix JavaTemplate replacements passing a J.NewArray into a vararg J.MethodInvocation#6572
timtebeek merged 4 commits intomainfrom
fix-varargs-replacement-with-template

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented Jan 20, 2026

@timtebeek timtebeek self-assigned this Jan 20, 2026
@timtebeek timtebeek added the bug Something isn't working label Jan 20, 2026
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Jan 20, 2026

class Example {
List<String> test() {
return java.util.Arrays.asList("a", "b", "c");
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Previously we were seeing asList({"a", "b", "c"}); as a result from a choice in #6556 to reuse J.NewArray to represent the varargs elements. Still agree with that choice, but it does mean we need special handling in substitutions below.

@timtebeek timtebeek marked this pull request as ready for review January 20, 2026 16:37
@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite Jan 20, 2026
@timtebeek timtebeek merged commit 93642f6 into main Jan 20, 2026
2 checks passed
@timtebeek timtebeek deleted the fix-varargs-replacement-with-template branch January 20, 2026 17:20
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working java

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants