...
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 | Repairable | Priority | Level |
|---|---|---|---|
VNA01-J | Low | Probable | Yes |
No | 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 |
Bibliography
Issue Tracking
| Tasklist | ||||
|---|---|---|---|---|
| ||||
||Completed||Priority||Locked||CreatedDate||CompletedDate||Assignee||Name|| |F|M|F|1270826173609| |dmohindr|"Unfortunately, a separate thread -could- *can* observe a stale reference in the helper field of the Foo class."| |T|M|F|1270826698362|1271441478121|svoboda|"This compliant solution synchronizes the methods of *class* Foo -class- " (it sounds strange with class occuring after Foo)| |
...
...