Community
Participate
Working Groups
There should be a compiler warning for serializable classes that do not explicitly declare serialVersionUID. For maximum effectiveness, this compiler option should be "warning" by default. ref: http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid Serializable classes that do not declare serialVersionUID are a serious problem for people who build products that rely on Java serialization. The problem is that many people forget that changing their class will introduce compatibility problems with earlier releases of their product, and that the compiler's computation of a SUID is so fragile that it is not recommended. In one case, only 50 of a product's 1500 serializable classes declared the SUID, making it difficult for them to provide inter-version compatibility. Best practice dictates that one always declares serialVersionUID. (There are lots more things that need to be done to manage Java serializability, but this is a cornerstore of policy.)
*** Bug 69959 has been marked as a duplicate of this bug. ***
*** Bug 67835 has been marked as a duplicate of this bug. ***
Cannot implement for 3.0.1 since it would require to add a new API ID on IProblem (for quickfix).
Added optional diagnosis, enabled as a warning by default as per request. Added IProblem.MissingSerialVersion problem ID.
New JavaCore option: * COMPILER / Reporting Missing Declaration of serialVersionUID Field on Serializable Class * When enabled, the compiler will issue an error or a warning whenever a serializable class is missing a local declaration * of a serialVersionUID field. This field must be declared as static final and be of type long. * - option id: "org.eclipse.jdt.core.compiler.problem.missingSerialVersion" * - possible values: { "error", "warning", "ignore" } * - default: "warning" Fixed.
I updated the "howto" of the batch compiler usage.