Replace constant with literal value

Apache 2.0

Replace a named constant with a literal value when you wish to remove the old constant. A String literal must include escaped quotes.

org.openrewrite.java.ReplaceConstant

Required

The target type in which the constant to be replaced is defined.

The name of the constant field to replace.

The literal value to replace.

mod run . --recipe=org.openrewrite.java.ReplaceConstant \ -P owningType=com.google.common.base.Charsets \ -P constantName=UTF_8 \ -P literalValue=UTF_8

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