Prefer if/throw over Guava's checkArgument and checkState

MSAL

Replace Guava's Preconditions.checkArgument(..) and Preconditions.checkState(..) statements with an if that throws IllegalArgumentException or IllegalStateException. A message template converts to String.format(..) only when it is a string literal whose placeholders are all %s and match the arguments.

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

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.