Use TreeVisitor#reduce instead of a captured accumulator

MSAL

Replaces 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.UseVisitorReduce
mod run . --recipe=org.openrewrite.java.recipes.UseVisitorReduce

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