Change method name
Apache 2.0Rename a method.
org. openrewrite. java. ChangeMethodNameRequired
A method pattern is used to find matching method invocations. For example, to find all method invocations in the Guava library, use the pattern: com.google.common..*#*(..).
The pattern format is <PACKAGE>#<METHOD_NAME>(<ARGS>).
..* includes all subpackages of com.google.common.*(..) matches any method name with any number of arguments.
For more specific queries, like Guava's ImmutableMap, use com.google.common.collect.ImmutableMap#*(..) to narrow down the results.
The method name that will replace the existing name.
Optional
When enabled, find methods that are overrides of the method pattern.
When set to true the definition of the old type will be left untouched. This is useful when you're replacing usage of a class but don't want to rename it.
mod run . --recipe= org. openrewrite. java. ChangeMethodName \
-P methodPattern= 'org. mockito. Matchers anyVararg()' \
-P newMethodName= anyInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.