Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 351641

Summary: Consider to omit explicit serialVersionUIDs for Serializables
Product: [RT] RAP Reporter: Rüdiger Herrmann <ruediger.herrmann>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 1.5   
Target Milestone: 1.5 M1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 342407    

Description Rüdiger Herrmann CLA 2011-07-09 15:46:14 EDT
A serialVersionUID is there to indicate the version of the _serialized form_ of the class in which it is declared. If the serialVersionUID is missing for a serializable class, one is generated. Everywhere its is recommended to use explicit serialVersionUIDs (e.g. in Effective Java 1nd ed., Bloch, p 223).

The generated version is affected by the class's name, the names of the interfaces it implements, and all of its public and protected members. Thus, even a small cange like a convenience method may change the generated version.

As long as they are only used to enable transparent session failover (bug 341761), I tend to omit explicit serialVersionUIDs for serializable classes for these reasons:
* the serialized form is stored for a 'short' term only. Currently, I can hardly imagine that in between serialization and deserialization, a new applications is deployed (and with it the version of the serialized form changes)
* maintaining an explicit serialVersionUID is hard. Each programmer that adds or removes fields from a serializable class must take the serial version into account. We have no quality assurance for this and establishing on is considerable work.
* many serialVersionUID declarations make the source code harder to read

If we decide to omit explicit versions, we would have to state (e.g. in SerializableCompatibility) somewhere that the serializability of classes in RWT isn't meant for general purpose use.
Comment 1 Rüdiger Herrmann CLA 2011-07-11 15:48:04 EDT
After discussing the issue with Ralf we came to the conclustion that we will go with what is suggested here.
Compiler problem severity for "missing serialVersionUID" was changed to'ignore'. The serialVersionUIDs that were already committed have been removed. Changes are in CVS HEAD.