Versions Compared

Key

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

...

This rule is an instance of rule OBJ06-J. Defensively copy mutable inputs and mutable internal components which applies to constructors and to other methods that accept untrusted mutable arguments, whereas this . This rule applies the same principle to deserialized mutable fields.

...

Wiki Markup
There is no need to copy immutable subobjects. Also, avoid using the subobject's {{clone()}} method because it can be overridden when the subobject's class is not nonfinalfinal and produces only a shallow copy. The references to the subobjects themselves must be nonfinal so that defensive copying can occur. It is also inadvisable to use the {{writeUnshared()}} and {{readUnshared()}} methods as an alternative \[[Bloch 2008|AA. Bibliography#Bloch 08]\].

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="9f59a796628b74ce-f602480d-4179497c-b50fa1fe-2f548c288cf21250cbb33ddc"><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="27574713b8e0a7fd-b6656fe8-4f584fa8-8ef186da-fbf0cf45f67cae1e5cb73818"><ac:plain-text-body><![CDATA[

[[Bloch 2008

AA. Bibliography#Bloch 08]]

Item 76, Write readObject methods defensively

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0817d3f484ccc769-6fcb9c49-4b5143cf-ab74ab0e-c88804ece881e1dbfb8c200a"><ac:plain-text-body><![CDATA[

[[Sun 2006

AA. Bibliography#Sun 06]]

Serialization Specification, A.6, Guarding Unshared Deserialized Objects

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

...