Prefer the Java 21 standard library instead of Guava

MSAL

Replace Guava's Maps and Sets new*WithExpectedSize factories, the primitive constrainToRange methods and ByteStreams.skipFully with their Java standard library equivalents on Java 21 or higher.

org.openrewrite.java.migrate.guava.NoGuavaJava21
mod run . --recipe=org.openrewrite.java.migrate.guava.NoGuavaJava21

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. Prefer JDK methods for Maps and Sets of an expected size
  2. Prefer Math#clamp
  3. Refaster template InputStreamRules.InputStreamSkipNBytes