Summary
Add the 'final' modifier to java.io.ObjectStreamClass.
Problem
ObjectStreamClass instances are created only from within the serialization mechanism, using either its private constructor or its package-private constructor. There are no subclasses of ObjectStreamClass.
Solution
ObjectStreamClass should be made final in order to express the design intent that it has no subclasses.
Specification
--- a/src/java.base/share/classes/java/io/ObjectStreamClass.java
+++ b/src/java.base/share/classes/java/io/ObjectStreamClass.java
@@ -80,7 +80,7 @@ import static java.io.ObjectStreamField.*;
* <cite>Java Object Serialization Specification,</cite> Section 4, "Class Descriptors"</a>
* @since 1.1
*/
-public class ObjectStreamClass implements Serializable {
+public final class ObjectStreamClass implements Serializable {
- csr of
-
JDK-8283715 Update ObjectStreamClass to be final
- Resolved