Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added exception

...

Code Block
bgColor#ccccff
private void readObject(final ObjectInputStream stream) throws 
    IOException, ClassNotFoundException {
  stream.defaultReadObject();
}

Exceptions

Wiki Markup
*EX1:* "The {{readObject}} methods will usually call {{java.io.ObjectInputStream.defaultReadObject}}, which is an overridable method." \[[SCG 09|AA. Java References#SCG 09]\]. 

Risk Assessment

Invoking overridable methods from the readObject() method can lead to initialization errors.

...

Wiki Markup
\[[API 06|AA. Java References#API 06]\] 
\[[SCG 09|AA. Java References#SCG 09]\] Guideline 4-4 Prevent constructors from calling methods that can be overridden
\[[Bloch 08|AA. Java References#Bloch 08]\] Item 17: "Design and document for inheritance or else prohibit it"

...