Prefer new String(Files.readAllBytes(path), charset)

MSAL

Replace Guava's Files.toString(File, Charset) and Files.asCharSource(File, Charset).read() with new String(java.nio.file.Files.readAllBytes(file.toPath()), charset). Like Guava, it replaces malformed input with the replacement character, where Files.readString(Path, Charset) throws a MalformedInputException.

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

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