Find Optional.get() / orElseThrow() calls

Proprietary

opt.get() is the unsafe unwrap that throws NoSuchElementException when the Optional is empty — the equivalent of Kotlin's !! on a nullable. Once the underlying value type is T?, the call site becomes value!! (or, better, a requireNotNull(value)).

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