Versions Compared

Key

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

...

Wiki Markup
Joshua Bloch \[[Bloch 2008|AA. Bibliography#Bloch 08]\] suggests implementing a {{stop()}} method explicitly such that it leaves the class in an unusable state beyond its lifetime. A {{private}} field within the class can signal whether the class is unusable. All the class methods must check this field prior to operating on the class. This is akin to [the first exception|OBJ05OBJ11-J. Prevent access to partially initialized objects#OBJ04-EX1] discussed in rule [OBJ05OBJ11-J. Prevent access to partially initialized objects]. As always, a good place to call the termination logic is in the {{finally}} block.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="199be930bf45617d-b8ead130-44724952-a3288e4c-6c27c009cb4719dd8f0fea50"><ac:plain-text-body><![CDATA[

[[MITRE 2009

AA. Bibliography#MITRE 09]]

[CWE ID 586

http://cwe.mitre.org/data/definitions/586.html] "Explicit Call to Finalize()", [CWE ID 583

http://cwe.mitre.org/data/definitions/583.html] "finalize() Method Declared Public"

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

 

CWE ID 568 "finalize() Method Without super.finalize()"

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="276d1ee6c51b297f-7b5dd0f4-41c241fd-9efeac06-61db5bcedcaa043db46ce5e2"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

[finalize()

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#finalize()]

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c72088ca7cc2112e-3cb7f213-4c0a4c83-a6549b3d-c58741256e8684b62f95a5a5"><ac:plain-text-body><![CDATA[

[[Bloch 2008

AA. Bibliography#Bloch 08]]

Item 7, Avoid finalizers

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="09a1f747b46d5fc1-025d6e03-44b54e4d-8ad891c3-a7187434ad0a8fa538fcfb3a"><ac:plain-text-body><![CDATA[

[[Boehm 2005

AA. Bibliography#Boehm 05]]

 

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="33fa67dc2c3bfa25-65ef6fc7-420d447f-b55db69f-d64260744a67cf6470bc7811"><ac:plain-text-body><![CDATA[

[[Coomes 2007

AA. Bibliography#Coomes 07]]

"Sneaky" Memory Retention

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="12bd1d939ca188cf-47fefa01-4a4340ec-a1b8ab04-7f6f2ee54aa3cb038c6a497a"><ac:plain-text-body><![CDATA[

[[Darwin 2004

AA. Bibliography#Darwin 04]]

Section 9.5, The Finalize Method

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a9ca141a03d89223-627add46-4bb94cba-819f906f-7ee48999e43facd0d3ed60e6"><ac:plain-text-body><![CDATA[

[[Flanagan 2005

AA. Bibliography#Flanagan 05]]

Section 3.3, Destroying and Finalizing Objects

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="77fee2737b87f247-9f57c479-43af4d33-ac659eb4-0c06cdd0c55e020c3d62d87c"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]]

Section 12.6, Finalization of Class Instances

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

...