Versions Compared

Key

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

...

This rule prohibits publishing a reference to a partially initialized member object instance before initialization has concluded. It specifically applies to safety in multithreaded code. The related rule TSM01-J. Do not let the ( this ) reference escape during object construction prohibits the this reference of the current object from escaping its constructor. Also see OBJ11-J. Be wary of letting constructors throw exceptions for some consequences of publishing partially-initialized objects even in single-threaded programs.

...

Consequently, the reference to the helper instance should remain unpublished until the Foo class's constructor has completed. See rule TSM01-J. Do not let the ( this ) reference escape during object construction for additional information.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="56173f9bc801fb5a-9eef696a-46c9486c-a1a68ce4-ffbcd3ae563a0e73121a54ce"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

 

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="25a8ca293f5abd25-8c832bdd-41234deb-9e5fbabc-eff9a87cea3501c0a4d0139b"><ac:plain-text-body><![CDATA[

[[Bloch 2001

AA. Bibliography#Bloch 01]]

Item 48: "Synchronize access to shared mutable data"

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="16aa1b6db5835d77-a8060893-4dd0437a-8496b048-418ad3e0d982e6742b0427cc"><ac:plain-text-body><![CDATA[

[[Goetz 2006

AA. Bibliography#Goetz 06]]

Section 3.5.3 "Safe Publication Idioms"

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="3414e2b04cacde8f-f981d425-47324896-a21098e5-958f0097dba6c846cb8e0744"><ac:plain-text-body><![CDATA[

[[Goetz 2007

AA. Bibliography#Goetz 07]]

Pattern #2: "one-time safe publication"

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2394a30b84a861d1-ff80f461-4f434fef-8558ba9b-65a62f0b5b7c88218bd3bdb6"><ac:plain-text-body><![CDATA[

[[JPL 2006

AA. Bibliography#JPL 06]]

14.10.2. "Final Fields and Security"

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="61066930c11403ec-d417e2b5-4d724887-acd9b28f-797fa30ed6e2fcf9391455c5"><ac:plain-text-body><![CDATA[

[[Pugh 2004

AA. Bibliography#Pugh 04]]

 

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

...