Empty Synchronized Block
ID |
java.empty_synchronized_block |
Severity |
low |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Reliability |
Language |
Java |
Tags |
CWE:1071, concurrency, reliability |
Rationale
An empty synchronized block acquires a monitor, does nothing, and releases it. This wastes CPU cycles, can cause unnecessary thread contention, and misleads readers into thinking the section protects some shared state. It usually indicates incomplete refactoring or a placeholder that was never filled in.
// Bad -- empty synchronized block
synchronized (lock) {
}