Synchronize lazy initialization of static fields

Proprietary

Adds synchronized to a static accessor that starts by lazily initializing a static, non-volatile field of its own class when it is null, so two threads cannot both run the initializer or see a partly constructed object. Lazy initializations already under a lock, in instance methods, after or inside other statements, or of another class's field are left alone, as are test sources and classes where the new synchronized method would make Sonar report another unlocked static field assignment.

io.moderne.staticanalysis.SynchronizeLazyStaticInitialization
mod run . --recipe=io.moderne.staticanalysis.SynchronizeLazyStaticInitialization

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