Find java.util.Collections / Arrays factory usage inside Kotlin

Proprietary

Arrays.asList, Collections.emptyList, Collections.singletonList, and Collections.unmodifiableList (plus Set/Map siblings) all have idiomatic Kotlin stdlib replacements — listOf, emptyList<T>(), setOf, mapOf, and .toList()/.toSet()/.toMap() for immutable copies.

org.openrewrite.kotlin.interop.FindJavaUtilCollectionsFriction$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.interop.FindJavaUtilCollectionsFriction$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. Find Arrays.asList(...) calls
  2. Find Collections.emptyList/Set/Map() calls
  3. Find Collections.singletonList/Set/Map(...) calls
  4. Find Collections.unmodifiableList/Set/Map(...) wrappers