...
Initialization cycles may lead to unexpected results.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
DCL00-J | Low | Unlikely | Medium | P2 | L3 |
Automated Detection
Tool | Version | Checker | Description | ||||
---|---|---|---|---|---|---|---|
CodeSonar |
|
FB.STYLE.IC_INIT_CIRCULARITY
JAVA.STRUCT.UA JAVA.STRUCT.UA.DEFAULT | Useless Assignment (Java) Useless Assignment to Default (Java) | |
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 | |
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 |
...
...