Files
openide/java/java-impl/resources/inspectionDescriptions/NonSerializableFieldInSerializableClass.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.4 KiB
HTML

<html>
<body>
Reports non-serializable fields in classes that implement <code>java.io.Serializable</code>. Such fields will result
in runtime exceptions if the object is serialized.
<p>
Fields declared
<code>transient</code> or <code>static</code>
are not reported, nor are fields of classes that have a <code>writeObject</code> method defined.
</p>
<p>
This inspection assumes fields of the types
<code>java.util.Collection</code> and
<code>java.util.Map</code> to be
<code>Serializable</code>, unless the types
they are declared in are non-<code>Serializable</code>.
</p>
<p><b>Example:</b></p>
<pre><code>
class NonSerializableClass {}
public class SerializableClass implements Serializable {
NonSerializableClass clazz; // warning: Non-serializable field 'clazz' in a Serializable class
static NonSerializableClass staticClazz; // no warnings
}
</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>
List annotations that will make the inspection ignore the annotated fields.
</li>
<li>
Whether to ignore fields initialized with an anonymous class.
</li>
</ul>
</body>
</html>