Replace a deprecated AWT method

MSAL

Replace calls to an AWT method deprecated since JDK 1.1 with calls to the method that replaced it. Declarations and super calls are left alone: the replacements delegate back to the deprecated methods, so a rewritten super call would reach overrides it used to bypass.

org.openrewrite.java.migrate.awt.ReplaceDeprecatedAwtMethod

Required

A method pattern matching the deprecated method; overrides of it are matched as well.

The name of the method that replaces the deprecated one.

Optional

booleanArgumentBoolean

A boolean literal to pass as an extra, last argument to the new method.

mod run . --recipe=org.openrewrite.java.migrate.awt.ReplaceDeprecatedAwtMethod \ -P methodPattern='java.awt.Component show()' \ -P newMethodName=setVisible

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