Reorder method arguments
Apache 2.0Reorder method arguments into the specified order.
org. openrewrite. java. ReorderMethodArgumentsRequired
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.
An array of parameter names that indicates the new order in which those arguments should be arranged. Separate values with commas.
Optional
If the original method signature is not type-attributed, this is an optional list that indicates the original order in which the arguments were arranged. Separate values with commas.
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.
When enabled, find methods that are overrides of the method pattern.
mod run . --recipe= org. openrewrite. java. ReorderMethodArguments \
-P methodPattern= 'com. yourorg. A foo(String, Integer, Integer)' \
-P newParameterNames= '[foo, bar, baz]'Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.