Prefer the Java 11 standard library instead of Guava
MSALReplace Guava's ImmutableList, ImmutableMap and ImmutableSet of and copyOf factories, MoreObjects.firstNonNull, the methods Guava marks @InlineMe and the ByteStreams methods that InputStream covers, with their Java standard library equivalents on Java 11 or higher.
org. openrewrite. java. migrate. guava. NoGuavaJava11mod run . --recipe= org. openrewrite. java. migrate. guava. NoGuavaJava11Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Inline Guava methods annotated with
@InlineMe - Prefer
List.of(..)in Java 9 or higher - Prefer
Map.of(..)in Java 9 or higher - Prefer
Set.of(..)in Java 9 or higher - Prefer
List.copyOf(..)in Java 10 or higher - Prefer
Map.copyOf(..)in Java 10 or higher - Prefer
Set.copyOf(..)in Java 10 or higher - Prefer
java.util.Objects#requireNonNullElse - Refaster template
InputStreamRules.InputStreamReadAllBytes - Refaster template
InputStreamRules.InputStreamReadNBytes - Refaster template
InputStreamRules.InputStreamTransferTo