...
Initialization cycles may lead to unexpected results.
Rule | Severity | Likelihood |
|---|
Detectable | Repairable | Priority | Level |
|---|---|---|---|
DCL00-J | Low | Unlikely |
Yes | No | P2 | L3 |
Automated Detection
| Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| CodeSonar |
| JAVA.STRUCT.SE.ASSERT JAVA.STRUCT.UA JAVA.STRUCT.UA.DEFAULT | Assertion contains side effects Useless assignment Useless assignment to default | ||||||
| Parasoft Jtest |
| CERT.DCL00.ACD | Ensure that files do not contain cyclical dependencies | ||||||
| PVS-Studio |
| V6050 | |||||||
| SonarQube |
| Classes should not access their own subclasses during initialization |
Related Guidelines
VOID DCL14-CPP. Avoid assumptions about the initialization order between translation units | |
| ISO/IEC TR 24772:2010 | Initialization of Variables [LAV] |
CWE-665, Improper Initialization |
Bibliography
Puzzle 49, "Larger than Life" | |
[JLS 2005] | §8.3.2.1, "Initializers for Class Variables" §12.4, "Initialization of Classes and Interfaces" |
| [Seacord 2015] | DCL00-J. Prevent class initialization cycles LiveLesson |
...
...