...
Allowing the this reference to escape can result in improper initialization and runtime exceptions.
Rule | Severity | Likelihood |
|---|
Detectable | Repairable | Priority | Level |
|---|---|---|---|
TSM01-J | Medium | Probable | Yes |
No |
P8 |
L2 |
Automated Detection
| Tool | Version | Checker | Description | ||||
|---|---|---|---|---|---|---|---|
| Parasoft Jtest |
|
| CERT.TSM01.CTRE |
| Do not let "this" reference escape during construction |
Bibliography
Section 3.2, "Publication and Escape" | |
Chapter 5, "Creational Patterns, Singleton" | |
| [JLS 2015] | §15.8.3, "this" |
Issue Tracking
| Tasklist | ||||
|---|---|---|---|---|
| ||||
||Completed||Priority||Locked||CreatedDate||CompletedDate||Assignee||Name|| |T|M|F|1270219843973|1270221864972|svoboda|"*Inner classes* implicitly hold a reference to the instance of the outer class, unless the inner class is declared as static." => Change inner classes to "An inner class implicitly holds ... "| |T|M|F|1270220129871|1270755934790|rcs|"Note that this code also violates CON32-J. Protect accessible mutable static fields from untrusted code" => Not sure if I agree because the class is package-private and inaccessible to untrusted code| |T|M|F|1270733657099|1271021912028|rcs_mgr|"A Runnable object's constructor may construct a Thread object around itself, as long as the thread is not actually started in the Runnable object's constructor." => I still think this info is redundant.| |
...
...