Find if (x == null) throw IllegalStateException(...) patterns

Proprietary

checkNotNull(x) { "…" } is the state-precondition twin of requireNotNull: throws IllegalStateException when x is null and smart-casts to non-nullable on return. Use it for invariants about the object's state, leaving requireNotNull for arguments.

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