Inline method calls

Apache 2.0

Inline method calls using a template replacement pattern. Supports both method invocations and constructor calls, with optional imports.

org.openrewrite.java.InlineMethodCalls

Required

A method pattern that is used to find matching method invocations.

The replacement template for the method invocation. Parameters can be referenced using their names from the original method.

Optional

List of regular imports to add when the replacement is made. Separate values with commas.

List of static imports to add when the replacement is made. Separate values with commas.

List of paths to JAR files on the classpath for parsing the replacement template. Separate values with commas.

mod run . --recipe=org.openrewrite.java.InlineMethodCalls \ -P methodPattern='com.google.common.base.Preconditions checkNotNull(..)' \ -P replacement='java.util.Objects.requireNonNull(#{p0})'

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