Use x instead of Optional.of(x).get()

Proprietary

Optional.of(x).get() is a JVM-style round-trip that's equivalent to x. In Kotlin you'd model the same thing with a non-nullable x directly, and Java callers already see the same value via the cross-language binding.

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