Find Object.wait() calls made while holding multiple monitors

MSAL

Finds zero-argument Object.wait() invocations whose enclosing method holds two or more monitors — either through nested synchronized (...) blocks, or a synchronized method combined with a nested synchronized block. wait() releases only the monitor of its receiver, so other held monitors continue to block their waiters and can deadlock. Timed waits (wait(long), wait(long, int)) are intentionally excluded — sonar-java's S3046 does the same, since timed waits are self-releasing and less likely to cause the failure mode.

org.openrewrite.staticanalysis.FindWaitWithMultipleLocksHeld
mod run . --recipe=org.openrewrite.staticanalysis.FindWaitWithMultipleLocksHeld

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