Prefer the Java 11 standard library instead of Guava

MSAL

Replace 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.NoGuavaJava11
mod run . --recipe=org.openrewrite.java.migrate.guava.NoGuavaJava11

Install 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.

  1. Inline Guava methods annotated with @InlineMe
  2. Prefer List.of(..) in Java 9 or higher
  3. Prefer Map.of(..) in Java 9 or higher
  4. Prefer Set.of(..) in Java 9 or higher
  5. Prefer List.copyOf(..) in Java 10 or higher
  6. Prefer Map.copyOf(..) in Java 10 or higher
  7. Prefer Set.copyOf(..) in Java 10 or higher
  8. Prefer java.util.Objects#requireNonNullElse
  9. Refaster template InputStreamRules.InputStreamReadAllBytes
  10. Refaster template InputStreamRules.InputStreamReadNBytes
  11. Refaster template InputStreamRules.InputStreamTransferTo