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

46 lines
1.3 KiB
HTML

<html>
<body>
Reports methods and fields in the <code>Serializable</code> and <code>Externalizable</code>
classes that are suitable to be annotated with the <code>java.io.Serial</code> annotation. The quick-fix adds the annotation.
<p><b>Example:</b></p>
<pre><code>
class Main implements Serializable {
private static final long serialVersionUID = 7874493593505141603L;
private void writeObject(ObjectOutputStream out) throws IOException {
}
}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
class Main implements Serializable {
@Serial
private static final long serialVersionUID = 7874493593505141603L;
@Serial
private void writeObject(ObjectOutputStream out) throws IOException {
}
}
</code></pre>
<p><b>Example:</b></p>
<pre><code>
class Main implements Externalizable {
protected Object readResolve() throws ObjectStreamException {
return "SomeObject";
}
}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
class Main implements Externalizable {
@Serial
protected Object readResolve() throws ObjectStreamException {
return "SomeObject";
}
}
</code></pre>
<p>For more information about all possible cases, refer to the Javadoc of the <code>java.io.Serial</code> class.</p>
<!-- tooltip end -->
<p><small>New in 2020.3</small></p>
</body>
</html>