|
43 | 43 | * serializable. The serialization interface has no methods or fields
|
44 | 44 | * and serves only to identify the semantics of being serializable. <p>
|
45 | 45 | *
|
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> |
60 | 59 | *
|
61 | 60 | * When traversing a graph, an object may be encountered that does not
|
62 | 61 | * support the Serializable interface. In this case the
|
|
135 | 134 | * accessibility rules as writeReplace.<p>
|
136 | 135 | *
|
137 | 136 | * 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 |
139 | 139 | * serialization and deserialization. Any declarations of the special
|
140 | 140 | * handling methods discussed above are ignored for enum types.<p>
|
141 | 141 | *
|
|
157 | 157 | * If a serializable class does not explicitly declare a serialVersionUID, then
|
158 | 158 | * the serialization runtime will calculate a default serialVersionUID value
|
159 | 159 | * 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 |
161 | 162 | * serialVersionUID of an enum type to be 0L. However, it is <em>strongly
|
162 | 163 | * recommended</em> that all serializable classes other than enum types explicitly declare
|
163 | 164 | * serialVersionUID values, since the default serialVersionUID computation is
|
|
179 | 180 | * @see java.io.ObjectOutput
|
180 | 181 | * @see java.io.ObjectInput
|
181 | 182 | * @see java.io.Externalizable
|
| 183 | + * @see <a href="{@docRoot}/../specs/serialization/index.html"> |
| 184 | + * <cite>Java Object Serialization Specification</cite></a> |
182 | 185 | * @since 1.1
|
183 | 186 | */
|
184 | 187 | public interface Serializable {
|
|
0 commit comments