Replace Paths.get with Path.of

MSAL

The java.nio.file.Paths.get method was introduced in Java SE 7. The java.nio.file.Path.of method was introduced in Java SE 11. This recipe replaces all usages of Paths.get with Path.of for consistency.

org.openrewrite.java.migrate.nio.file.PathsGetToPathOf
mod run . --recipe=org.openrewrite.java.migrate.nio.file.PathsGetToPathOf

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 target to static
  2. Change method name java.nio.file.Path get(..) to of