Files
openide/java/java-impl/resources/inspectionDescriptions/ReadResolveAndWriteReplaceProtected.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

25 lines
815 B
HTML

<html>
<body>
Reports classes that implement <code>java.io.Serializable</code> where the <code>readResolve()</code>
or <code>writeReplace()</code> methods are not declared <code>protected</code>.
<p>
Declaring <code>readResolve()</code> and <code>writeReplace()</code> methods <code>private</code>
can force subclasses to silently ignore them, while declaring them
<code>public</code> allows them to be invoked by untrusted code.
</p>
<p>
If the containing class is declared <code>final</code>, these methods can be declared <code>private</code>.
</p>
<p><b>Example:</b></p>
<pre><code>
class ClassWithSerialization implements Serializable {
public Object writeReplace() { // warning: 'writeReplace()' not declared protected
...
}
}
</code>
</pre>
<!-- tooltip end -->
</body>
</html>