When I serialize an object, I can use the serialVersionUID mechanism at the class level to ensure the compatibility of the two types.
However, what happens when I serialize fields of enum values? Is there a way to ensure that the enum type has not been manipulated between serialization and deserialization?
Suppose that I have an enum like OperationResult {SUCCESS, FAIL}, and a field called “result” in an object that is being serialized. How do I ensure, when the object is deserialized, that result is still correct even if someone maliciously reversed the two? (Suppose the enum is declared elsewhere as a static enum)
I am wondering out of curiosity – I use jar-level authentication to prevent manipulation.
From: http://www.theserverside.com/news/thread.tss?thread_id=50190#265205
Therefore, it looks like enum objects cannot be serialised and deserialised in their entirety. Also, from http://java.sun.com/javase/6/docs/platform/serialization/spec/serial-arch.html#6469: