...
Synchronizing on the class object returned by getClass() can result in nondeterministic undesired behavior.
Rule | Severity | Likelihood | Detectable |
|---|
Repairable | Priority | Level |
|---|---|---|
LCK02-J | Medium | Probable |
Yes | No | P8 | L2 |
Automated Detection
Some static analysis tools can detect violations of this rule
| Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Parasoft Jtest |
| CERT.LCK02.SGC | Do not synchronize on the class object returned by the 'getClass' method | ||||||
| SonarQube |
|
...
Bibliography
...
...