Skip to content

Commit

Permalink
Merge pull request #18480 from github/smowton/admin/document-serializ…
Browse files Browse the repository at this point in the history
…ation-proxy

Java: document serialization proxy pattern
  • Loading branch information
smowton authored Jan 14, 2025
2 parents 0ff37f1 + 0b62338 commit 3e10e78
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ is not the case. The error will be detected at runtime. </p>

</overview>
<recommendation>
<p>Make sure that every non-serializable class that is extended by a serializable class has a no-argument constructor.</p>
<p>Make sure that every non-serializable class that is extended by a serializable class has a no-argument constructor.
Alternatively, consider defining a <code>writeReplace</code> method that replaces the <code>Serializable</code> class instance with
a serialization proxy, so as to avoid direct deserialization of a class whose parent lacks a no-argument constructor.</p>

</recommendation>
<example>
Expand Down

0 comments on commit 3e10e78

Please sign in to comment.