...
The incorrect assumption that classes that contain only references to immutable objects are themselves immutable can cause serious thread-safety issues.
Rule | Severity | Likelihood | Detectable | RepairableRemediation Cost | Priority | Level |
|---|---|---|---|---|---|---|
VNA01-J | Low | Probable | Yes | NoMedium | P4 | L3 |
Automated Detection
Some static analysis tools are capable of detecting violations of this rule.
| Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Klocwork |
| SV.SHARED.VAR | |||||||
| Parasoft Jtest |
| CERT.VNA01.SGAS | Use the synchronized keyword on both the getter and setter methods, or on neither | ||||||
| ThreadSafe |
| CCE_SL_INCONSISTENT | Implemented | ||||||
| SonarQube |
| S2886 | Getters and setters should be synchronized in pairs |
...