Prefer Math#subtractExact

MSAL

Prefer java.lang.Math#subtractExact instead of using com.google.common.math.IntMath#checkedSubtract.

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

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. Change method name com.google.common.math.IntMath checkedSubtract(..) to subtractExact
  2. Change method target to static