Versions Compared

Key

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

...

More information on correctly handling singleton classes is available in the rule MSC11 MSC07-J. Prevent multiple instantiations of singleton objects.

Code Block
bgColor#ccccff
class SingletonClass extends Exception {
  // ...
  private final Object readResolve() throws NotSerializableException {
    return INSTANCE;
  }
}

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="470f0230124ff548-6da4ec51-408d4744-b9b5a0e3-277b8df267027b78421f67b6"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

Class Object, Class Hashtable

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0783057a56b094cc-be72a540-45504641-b03da263-1813fc9e67211d2517b25ead"><ac:plain-text-body><![CDATA[

[[Bloch 2008

AA. Bibliography#Bloch 08]]

Item 75: "Consider using a custom serialized form"

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f7f041bfbc432d6b-632faa3e-41164770-8b138ed5-3aa08e8853e7e0455ec8e674"><ac:plain-text-body><![CDATA[

[[Greanier 2000

AA. Bibliography#Greanier 00]]

 

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="3718c8620af7b6ca-06fdff9c-42a04305-bbf88f4d-90f7d049079b500e8c27b2b0"><ac:plain-text-body><![CDATA[

[[Harold 1999

AA. Bibliography#Harold 99]]

Chapter 11: Object Serialization, Validation

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="e55ca31a4c13d358-c163dd77-44ba4c67-851abc56-c36a3403153f982d8b30947f"><ac:plain-text-body><![CDATA[

[[Hawtin 2008

AA. Bibliography#Hawtin 08]]

Antipattern 8: Believing deserialisation is unrelated to construction

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

...