Add comment to method invocations
Apache 2.0Add a comment to method invocations in a Java source file.
org. openrewrite. java. AddCommentToMethodInvocationsRequired
The comment to add.
A pattern to match methods to add the comment to. 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.
mod run . --recipe= org. openrewrite. java. AddCommentToMethodInvocations \
-P comment= 'This is a comment. ' \
-P methodPattern= 'java. util. List add*(.. )'Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.