Find if (x != null) y = x.foo() patterns
Proprietaryif (x != null) y = x.foo() followed by a default elsewhere reads as a hand-rolled y = x?.foo() ?: default. The elvis form keeps the value derivation in one expression.
org. openrewrite. kotlin. idiom. FindIfNotNullAssign$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. idiom. FindIfNotNullAssign$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.