I've been whinging elsewhere about the lack of genuine advanced issues in this Advanced forum, but I think I might have one here. It's about serialisation, so one might argue I/O and Streams is a better forum. Anyway...
I have an application that is required to be able to read saved serialised states from old versions of the application. We fix the serialVersionUID of our own classes, to help to ensure this. However, I have made a mistake.
In one of our classes, I included an array of ProgressType objects, which are objects of a generated CORBA enum type. Being generated code, I can't fix its serialVersionUID. This enum has recently gained some new members, so its serialVersionUID has changed.
Now, when I try to use the latest classes to read one of the objects whose state includes ProgressType, within a serialised state from older versions of the classes, I get an InvalidClassException: -
com.harlequin.DPP.SOAR.RIPInterface.ProgressType; local class incompatible: stream classdesc serialVersionUID = -8705812033005380768, local class serialVersionUID = 1804412345902867916
I am familiar with some of the ways that default serialisation mechanism can be overridden, but cannot immediately see how any of them would help in this situation.
Can anyone think of a way to read one of the old states?
P.S. What I should have done is to store the integer equivalents of the ProgressType enum objects. Primitives don't have serialVersionUIDs. But it's too late now, as states containing ProgressType objects are already out there.