Chapter 3. Declarations and Initialization (DCL)

Rules

Image

Risk Assessment Summary

Image

DCL00-J. Prevent class initialization cycles

According to the Java Language Specification (JLS), §12.4, “Initialization of Classes and Interfaces” [JLS 2005]:

Initialization of a class consists of executing its static initializers and the initializers for static fields (class variables) declared in the class.

In other words, the presence of a static field triggers the initialization of a class. However, a static field could also depend on the initialization of another ...

Get The CERT® Oracle® Secure Coding Standard for Java™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.