Versions Compared

Key

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

...

Note that defensive copies performed during execution of a constructor must avoid use of the clone() method when the class could be subclassed by untrusted code. This restriction prevents execution of a maliciously crafted overriding of the clone() method. For more details, see rule OBJ07-J. Limit extensibility of classes and methods with invariants to trusted subclasses onlySensitive classes must not let themselves be copied.

Classes that have public setter methods, that is, methods whose purpose is to change class fields, must follow the related advice found in rule OBJ06-J. Defensively copy mutable inputs and mutable internal components. Note that setter methods can (and usually should) perform input validation and sanitization before setting internal fields.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="9a5d935af35d68bb-1dbd22ff-45b64066-abd58e05-81eb13f9633b4a0dfe603a5d"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

[Method clone()

http://java.sun.com/javase/6/docs/api/java/lang/Object.html#clone()]

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="45343e4f61b7a6ea-8c302196-4fbf460c-96c1b17f-4ea58d45b27a5e35737ff1e8"><ac:plain-text-body><![CDATA[

[[Bloch 2008

AA. Bibliography#Bloch 08]]

Item 39. Make defensive copies when needed

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="77e4bb965d18980e-97db21fc-47324323-8e17b1fb-ef79f5f999d6a95c71fd8cba"><ac:plain-text-body><![CDATA[

[[Goetz 2006

AA. Bibliography#Goetz 06]]

3.2, Publication and Escape: Allowing Internal Mutable State to Escape

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f632058c08ce7fa7-ed175bab-4dee43ee-a85baea9-ce3da5065f18cd99e5daf295"><ac:plain-text-body><![CDATA[

[[Gong 2003

AA. Bibliography#Gong 03]]

9.4, Private Object State and Object Immutability

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="58889833dde76e0c-6347a51b-47bd458b-8fb28748-aded86d68bb62b388b2d9e12"><ac:plain-text-body><![CDATA[

[[Haggar 2000

AA. Bibliography#Haggar 00]]

[Practical Java Praxis 64. Use clone for immutable objects when passing or receiving object references to mutable objects

http://www.informit.com/articles/article.aspx?p=20530]

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c1dbed9db3862012-39e3d7db-4e3a485a-a35788b4-6b351467727f934316452b32"><ac:plain-text-body><![CDATA[

[[Security 2006

AA. Bibliography#Security 06]]

 

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

...