Community
Participate
Working Groups
Build ID: M20090211-1700 Steps To Reproduce: 1. Create new serializable class. 2. Generate serialVersionUID field as java.io.Serializable and IDE suggests. 3. Do any of the following in this class: 3.1. Create new method. 3.2. Create new field. 3.3. Change any existing method's signature (name or argument(s) type(s)) 4. serialVersionUID now became invalid although IDE don't warn you. More information: Don't know if recalculation of serialVersionUID should be done as soon any relevant class changes made, or on file save event, or periodically in the background (sudden error appearing "from nowhere" will be confusing for user). For me it's uncomfortable to always remember that I should manually recalculate that fields. I think it's IDE job, and essential one, 'cause without it it would be hard to fix unexplainable deserialization errors during later runtime.
It depends what you want to do. You might not want to change the serialVersionUID if you want to keep backward compatibility with existing persisted instances of this class.
Agree. Then IDE may have a warning on serialVersionUID field just like it has it on Serializable class which has no serialVersionUID field at all. And make it possible to switch this warning off just like "Serializable class without serialVersionUID: Error/Warning/Ignore" Java compiler option. Plus there will be a little use of keeping backward compatibility when you change class' elements old clients depend on, they will break anyway.