mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
23 lines
823 B
HTML
23 lines
823 B
HTML
<html>
|
|
<body>
|
|
Reports non-<code>Serializable</code> objects used as arguments to
|
|
<code>java.io.ObjectOutputStream.write()</code>. Such calls will result in runtime exceptions.
|
|
<p>
|
|
This inspection assumes objects 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>
|
|
public class IWantToSerializeThis {
|
|
public static void main(String[] args) throws IOException {
|
|
try(var stream = new ObjectOutputStream(Files.newOutputStream(Paths.get("output")))) {
|
|
// Warning -- will fail with NotSerializableException
|
|
stream.writeObject(new IWantToSerializeThis());
|
|
}
|
|
}
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |