Find LoggerFactory.getLogger calls inside collection lambdas

Proprietary

LoggerFactory.getLogger(...) resolves the logger through SLF4J on every call. Inside a collection lambda that resolves the same logger per element — hoist it to a private val companion property.

org.openrewrite.kotlin.performance.FindLoggerFactoryGetLoggerInCollectionLambdas$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.performance.FindLoggerFactoryGetLoggerInCollectionLambdas$KtRecipe'

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