Skip to content

Support copyOf migration for Guava#1062

Merged
greg-at-moderne merged 2 commits intomainfrom
greg-guava-copyof-recipes
Apr 16, 2026
Merged

Support copyOf migration for Guava#1062
greg-at-moderne merged 2 commits intomainfrom
greg-guava-copyof-recipes

Conversation

@greg-at-moderne
Copy link
Copy Markdown
Contributor

What's changed?

Adding three new building recipes for No Guava recipe:

  • NoGuavaImmutableListCopyOf
  • NoGuavaImmutableSetCopyOf
  • NoGuavaImmutableMapCopyOf

modelled after (or actually now sharing code with) the existing:

  • NoGuavaImmutableListOf
  • NoGuavaImmutableMapOf
  • NoGuavaImmutableSetOf

What's your motivation?

@greg-at-moderne greg-at-moderne self-assigned this Apr 15, 2026
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Apr 15, 2026
@steve-aom-elliott
Copy link
Copy Markdown
Contributor

steve-aom-elliott commented Apr 15, 2026

Looking at the comments on

(a previous attempt), would it have made more sense to have an AbstractNoGuavaImmutable that has the generic logic and intermediate layers being AbstractNoGuavaImmutableOf and AbstractNoGuavaImmutableCopyOf that would provide the copyOf or of method name rather than bringing that down to the individual recipes and changing the signature of the AbstractNoGuavaImmutableOf?

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Apr 15, 2026
@greg-at-moderne
Copy link
Copy Markdown
Contributor Author

intermediate layers

To be honest, that was one of the options I have considered. But this looked like somewhat artificial exercise in OOP.
Happy to adapt to it, if we agree on this.

@greg-at-moderne
Copy link
Copy Markdown
Contributor Author

Merging, we can always consider refaxtoring the code later on.

@greg-at-moderne greg-at-moderne merged commit 634e7d9 into main Apr 16, 2026
1 check passed
@greg-at-moderne greg-at-moderne deleted the greg-guava-copyof-recipes branch April 16, 2026 02:28
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Recipes to replace Guava Immutable{Set|List|Map}.copyOf() calls with Java {Set|List|Map}.copyOf() calls

3 participants