Find writes to static fields from instance methods

Proprietary

Finds assignments, compound assignments (+=, -=, ...), and ++/-- operators that target a static field from inside a non-static instance method. Such writes race across instances and obscure ownership of the state; per Sonar S2696 the method should be made static or the state guarded by a thread-safe accessor.

org.openrewrite.java.security.search.FindInstanceMethodStaticFieldWrite
mod run . --recipe=org.openrewrite.java.security.search.FindInstanceMethodStaticFieldWrite

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