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

41 lines
1.4 KiB
HTML

<html>
<body>
Reports non-static inner classes that implement <code>java.io.Serializable</code>, but do not define a <code>serialVersionUID</code> field.
<p>
Without a <code>serialVersionUID</code> field, any change to the class will make previously
serialized versions unreadable. It is strongly recommended that <code>Serializable</code>
non-static inner classes have a <code>serialVersionUID</code> field, otherwise the default
serialization algorithm may result in serialized versions being incompatible between
compilers due to differences in synthetic accessor methods.
</p>
<p>
A quick-fix is suggested to add the missing <code>serialVersionUID</code> field.
</p>
<p><b>Example:</b></p>
<pre><code>
class Outer {
class Inner implements Serializable {}
}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
class Outer {
class Inner implements Serializable {
private static final long serialVersionUID = -7004458730436243902L;
}
}
</code></pre>
<!-- tooltip end -->
<p>Use the following options to configure the inspection:</p>
<ul>
<li>
List classes whose inheritors should not be reported by this inspection.
This is meant for classes that inherit
<code>Serializable</code> from a superclass but are not intended for serialization.
</li>
<li>
Whether to ignore <code>Serializable</code> anonymous classes.
</li>
</ul>
</body>
</html>