On Wed, 13 Jan 2021 06:10:53 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
> Why do we add serialVersionUID in some classes like
> DefaultMutableTreeNode.java but not in other swing classes?
Most Swing classes are marked by the specific "Warning" that "Same-version
serialization only" is supported. (I think such a warning is missed in a few
classes). So generally the serialVersionUID field is not needed in such
classes, but if present this provides a small benefit -> this UID is not
generated at runtime.
For example, the DefaultMutableTreeNode was updated by the JDK-5017904 fix,
which was unrelated to serialization but was targeted for the performance issue.
> Also, if this change is for stricter compile-time checking, shouldn't we
> remove @SuppressWarnings("serial") check?
At some point, we probably can remove it but will need to fix all serialization
warnings which were disabled.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2020