Skip to content

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

@knutwannheden

Description

@knutwannheden

Since Java 10 the interfaces Set, List, and Map declare static copyOf() methods which are equivalent to the copyOf() counterparts in Guava's ImmutableSet, ImmutableList, and ImmutableMap counterparts.

Implement three imperative recipes which implement this migration. It would probably make sense to create an abstract supertype based on AbstractNoGuavaImmutableOf, so that the recipes can be declared as subtypes of that new abstract base class. As noted the precondition would be Java 10.

There should be some test cases for this (again similarly to as how it was done for the implementations of AbstractNoGuavaImmutableOf) and finally the three new recipes should be added to the recipe list of org.openrewrite.java.migrate.guava.NoGuavaJava11 which is declared in no-guava.yml, where also the other three mentioned recipes are already declared.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions