Empty 'synchronized' statement
synchronized statements with empty bodies.
synchronized statements are sometimes used to wait for other threads to release a particular resource. However, there is no guarantee that the same resource won't be acquired again right after the empty
synchronized statement finishes. For proper synchronization, the resource should be utilized inside the
Also, an empty
synchronized block may appear after a refactoring when redundant code was removed. In this case, the
synchronized block itself will be redundant and should be removed as well.
A quick-fix is suggested to remove the empty synchronized statement.
This inspection is disabled in JSP files.
IntelliJ IDEA 2023.3, Qodana for JVM 2023.3