Find Thread.start() calls made during construction of a non-final class

MSAL

Finds Thread.start() invocations reached during construction of a non-final class — from a constructor body, an instance field initializer, or an instance initializer block. Starting a thread before construction completes lets the new thread observe a partially-initialised object; the problem is compounded when a subclass extends the class, because the superclass constructor starts the thread before the subclass' own fields have been initialised. Move the start() call to a separate method callers invoke after construction, or declare the class final.

org.openrewrite.java.migrate.lang.FindThreadStartInConstructor
mod run . --recipe=org.openrewrite.java.migrate.lang.FindThreadStartInConstructor

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.