Prefer emptyList() / emptySet() / emptyMap() over zero-arg builders

Proprietary

When listOf() / setOf() / mapOf() are called with no entries, replace them with the explicit emptyList() / emptySet() / emptyMap() factories so the empty-by-construction intent is visible at the call site.

org.openrewrite.kotlin.stdlib.EmptyConstructorShorthands$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.stdlib.EmptyConstructorShorthands$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.

Recipe list

It runs these recipes, in this order.

  1. Use emptyList<T>() instead of listOf<T>()
  2. Use emptySet<T>() instead of setOf<T>()
  3. Use emptyMap<K, V>() instead of mapOf<K, V>()