Add method parameter to a method declaration

Apache 2.0

Adds a new method parameter to an existing method declaration.

org.openrewrite.java.AddMethodParameter

Required

A method pattern that is used to find the method declarations to modify.

The type of the parameter that gets added.

The name of the parameter that gets added.

Optional

A zero-based index that indicates the position at which the parameter will be added. At the end by default.

mod run . --recipe=org.openrewrite.java.AddMethodParameter \ -P methodPattern='com.yourorg.A foo(int, int)' \ -P parameterType=java.lang.String \ -P parameterName=name

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