Find method calls and say what to do instead
MSALFinds method calls, constructor calls and method references matching a method pattern, and marks each one with advice on what to do instead, so whoever reads the result knows the next step.
org. openrewrite. java. recipes. FindMethodsWithAdviceRequired
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.
What to do instead, shown on each match.
Optional
When enabled, find methods that are overrides of the method pattern.
mod run . --recipe= org. openrewrite. java. recipes. FindMethodsWithAdvice \
-P methodPattern= 'org. openrewrite. ExecutionContext getMessages()' \
-P advice= 'Keep state across source files in a `ScanningRecipe` accumulator'Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.