JDK 18 |
---|
18 b21Fixed |
CSR :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
JDK-8281497 :
|
The core check of javac's serial lint warning (JDK-4767441) is to verify the presence of a properly declared serialVersionUID field in serializable classes. There are other useful checks that could be added, including that serial-involved methods are properly declared rather than being overloads which will get ignored by the serialization system. Those methods include: private void writeObject(java.io.ObjectOutputStream stream) throws IOException; private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException; private void readObjectNoData() throws ObjectStreamException as discussed in java.io.ObjectInputStream and java.io.ObjectOutputStream. In additional, the serialization spec discusses the methods: ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException; ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException; Additional methods are defined for Externalization.
|