Skip to content

Commit cc0ed40

Browse files
author
Stuart Marks
committed
8037384: Fix wording in Javadoc of java.io.Serializable
8231547: Serializable class doc should link to serialization specification Reviewed-by: rriggs, iris, chegar
1 parent 19b2898 commit cc0ed40

File tree

5 files changed

+26
-22
lines changed

5 files changed

+26
-22
lines changed

src/java.base/share/classes/java/io/ObjectInputStream.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@
242242
* The record components are deserialized prior to the invocation of the record
243243
* constructor, hence this limitation (see
244244
* <a href="{@docRoot}/../specs/serialization/serial-arch.html#cyclic-references">
245-
* [Section 1.14, "Circular References"</a> for additional information).
245+
* <cite>Java Object Serialization Specification,</cite>
246+
* Section 1.14, "Circular References"</a> for additional information).
246247
* The process by which record objects are serialized or externalized cannot be
247248
* customized; any class-specific writeObject, readObject, readObjectNoData,
248249
* writeExternal, and readExternal methods defined by record classes are
@@ -262,7 +263,7 @@
262263
* @see java.io.ObjectOutputStream
263264
* @see java.io.Serializable
264265
* @see <a href="{@docRoot}/../specs/serialization/input.html">
265-
* Object Serialization Specification, Section 3, Object Input Classes</a>
266+
* <cite>Java Object Serialization Specification,</cite> Section 3, "Object Input Classes"</a>
266267
* @since 1.1
267268
*/
268269
public class ObjectInputStream

src/java.base/share/classes/java/io/ObjectOutputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
* @see java.io.Serializable
162162
* @see java.io.Externalizable
163163
* @see <a href="{@docRoot}/../specs/serialization/output.html">
164-
* Object Serialization Specification, Section 2, Object Output Classes</a>
164+
* <cite>Java Object Serialization Specification,</cite> Section 2, "Object Output Classes"</a>
165165
* @since 1.1
166166
*/
167167
public class ObjectOutputStream

src/java.base/share/classes/java/io/ObjectStreamClass.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@
7676
*
7777
* <p>The algorithm to compute the SerialVersionUID is described in
7878
* <a href="{@docRoot}/../specs/serialization/class.html#stream-unique-identifiers">
79-
* Object Serialization Specification, Section 4.6, Stream Unique Identifiers</a>.
79+
* <cite>Java Object Serialization Specification,</cite> Section 4.6, "Stream Unique Identifiers"</a>.
8080
*
8181
* @author Mike Warres
8282
* @author Roger Riggs
8383
* @see ObjectStreamField
8484
* @see <a href="{@docRoot}/../specs/serialization/class.html">
85-
* Object Serialization Specification, Section 4, Class Descriptors</a>
85+
* <cite>Java Object Serialization Specification,</cite> Section 4, "Class Descriptors"</a>
8686
* @since 1.1
8787
*/
8888
public class ObjectStreamClass implements Serializable {

src/java.base/share/classes/java/io/Serializable.java

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,19 @@
4343
* serializable. The serialization interface has no methods or fields
4444
* and serves only to identify the semantics of being serializable. <p>
4545
*
46-
* To allow subtypes of non-serializable classes to be serialized, the
47-
* subtype may assume responsibility for saving and restoring the
48-
* state of the supertype's public, protected, and (if accessible)
49-
* package fields. The subtype may assume this responsibility only if
50-
* the class it extends has an accessible no-arg constructor to
51-
* initialize the class's state. It is an error to declare a class
52-
* Serializable if this is not the case. The error will be detected at
53-
* runtime. <p>
54-
*
55-
* During deserialization, the fields of non-serializable classes will
56-
* be initialized using the public or protected no-arg constructor of
57-
* the class. A no-arg constructor must be accessible to the subclass
58-
* that is serializable. The fields of serializable subclasses will
59-
* be restored from the stream. <p>
46+
* It is possible for subtypes of non-serializable classes to be serialized
47+
* and deserialized. During serialization, no data will be written for the
48+
* fields of non-serializable superclasses. During deserialization, the fields of non-serializable
49+
* superclasses will be initialized using the no-arg constructor of the first (bottommost)
50+
* non-serializable superclass. This constructor must be accessible to the subclass that is being
51+
* deserialized. It is an error to declare a class Serializable if this is not
52+
* the case; the error will be detected at runtime. A serializable subtype may
53+
* assume responsibility for saving and restoring the state of a non-serializable
54+
* supertype's public, protected, and (if accessible) package-access fields. See
55+
* the <a href="{@docRoot}/../specs/serialization/input.html#the-objectinputstream-class">
56+
* <cite>Java Object Serialization Specification,</cite></a> section 3.1, for
57+
* a detailed specification of the deserialization process, including handling of
58+
* serializable and non-serializable classes. <p>
6059
*
6160
* When traversing a graph, an object may be encountered that does not
6261
* support the Serializable interface. In this case the
@@ -135,7 +134,8 @@
135134
* accessibility rules as writeReplace.<p>
136135
*
137136
* Enum types are all serializable and receive treatment defined by
138-
* the <cite>Java Object Serialization Specification</cite> during
137+
* the <a href="{@docRoot}/../specs/serialization/index.html"><cite>
138+
* Java Object Serialization Specification</cite></a> during
139139
* serialization and deserialization. Any declarations of the special
140140
* handling methods discussed above are ignored for enum types.<p>
141141
*
@@ -157,7 +157,8 @@
157157
* If a serializable class does not explicitly declare a serialVersionUID, then
158158
* the serialization runtime will calculate a default serialVersionUID value
159159
* for that class based on various aspects of the class, as described in the
160-
* Java Object Serialization Specification. This specification defines the
160+
* <a href="{@docRoot}/../specs/serialization/index.html"><cite>Java Object Serialization
161+
* Specification.</cite></a> This specification defines the
161162
* serialVersionUID of an enum type to be 0L. However, it is <em>strongly
162163
* recommended</em> that all serializable classes other than enum types explicitly declare
163164
* serialVersionUID values, since the default serialVersionUID computation is
@@ -179,6 +180,8 @@
179180
* @see java.io.ObjectOutput
180181
* @see java.io.ObjectInput
181182
* @see java.io.Externalizable
183+
* @see <a href="{@docRoot}/../specs/serialization/index.html">
184+
* <cite>Java Object Serialization Specification</cite></a>
182185
* @since 1.1
183186
*/
184187
public interface Serializable {

src/java.base/share/classes/java/io/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* </strong></p>
4040
* <ul>
4141
* <li><a href="{@docRoot}/../specs/serialization/index.html">
42-
* Java Object Serialization Specification </a>
42+
* <cite>Java Object Serialization Specification</cite></a>
4343
* <li>{@extLink serialization_filter_guide Serial Filtering} best practices</li>
4444
* <li>{@extLink serialver_tool_reference The serialver tool}</li>
4545
* </ul>

0 commit comments

Comments
 (0)