CWE-585

Empty Synchronized Block
AI Translation Available

The product contains an empty synchronized block.

Status
draft
Abstraction
variant
Java

An empty synchronized block does not actually accomplish any synchronization and may indicate a troubled section of code. An empty synchronized block can occur because code no longer needed within the synchronized block is commented out without removing the synchronized block.

Common Consequences

other
Impacts
other

Detection Methods

automated static analysis

Potential Mitigations

Phases:
implementation
Descriptions:
• When you come across an empty synchronized statement, or a synchronized statement in which the code has been commented out, try to determine what the original intentions were and whether or not the synchronized block is still necessary.