Use TreeVisitor#reduce instead of a captured accumulator
MSALReplaces an accumulator that is declared, passed to TreeVisitor#visit and only read afterwards with a call to TreeVisitor#reduce, which returns the accumulator it was given. When the accumulator is read only once, right after the visit, the reduce call is inlined at that read.
org. openrewrite. java. recipes. UseVisitorReducemod run . --recipe= org. openrewrite. java. recipes. UseVisitorReduceInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.