Tuesday, February 15, 2011

SerialVersionUID

http://www.javablogging.com/what-is-serialversionuid/

a simple and practical example on how it works.

http://download.oracle.com/javase/1.5.0/docs/api/java/io/Serializable.html Javadocs say that "it is strongly recommended that all serializable classes explicitly declare serialVersionUID values"...


IMHO if you declare the serialVersionUID and don't change it when you modify the class, it's USELESS. So either you have an automated mechanism to change it every time the Class is checked in, otherwise simply DON'T DECLARE IT and let the JVM work a little harder.

If this really becomes a performance issue (and you will discover it when you profile your application) then it will take you 10 minutes to add it to all your classes.

Remember to add @SuppressWarnings("serial")

No comments: