Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Wiki MarkupTherefore, the presence of a {{static}} field triggers the initialization of a class. However, the initializer of a static field could depend on the initialization of another class, possibly creating an initialization cycle.

Wiki Markup
 The JLS also states in [§8.3.2.1, "Initializers for Class Variables" |http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.3.2.1] \[[JLS 2005|AA. References#JLS 05]\]

...

The CERT C++ Secure Coding Standard

DCL14-CPP. Avoid assumptions about the initialization order between translation units

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="85f0afa2fa628087-08fdf42b-43b54c34-86c19a8d-36567508802907a07abc21dd"><ac:plain-text-body><![CDATA[

[ISO/IEC TR 24772:2010

http://www.aitcnet.org/isai/]

Initialization of variables [LAV]

]]></ac:plain-text-body></ac:structured-macro>

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="db63dda6c2fde9a7-15ef6ff1-403448c2-8b3f8313-72789e69814b1aa423bf934f"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. References#JLS 05]]

[§8.3.2.1, Initializers for Class Variables

http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.3.2.1]

]]></ac:plain-text-body></ac:structured-macro>

 

§12.4, Initialization of Classes and Interfaces

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="77f1d3c147583e93-a6a470b1-4fae4709-b9fb848d-3b4cd94ff3a13a66ba365956"><ac:plain-text-body><![CDATA[

[[Bloch 2005

AA. References#Bloch 05]]

Puzzle 49. Larger than life

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="41d0d678a057e9fa-d00eaae8-4f334074-8315b25c-790ff4d53789a551a6d307bd"><ac:plain-text-body><![CDATA[

[[MITRE 2009

AA. References#MITRE 09]]

[CWE-665

http://cwe.mitre.org/data/definitions/665.html]. Improper initialization

]]></ac:plain-text-body></ac:structured-macro>

...