M
Mohammad Faraziyan
Hello,
I am writing a program which serializes objects in a file using
ObjectOutputStream and ObjectInputStream. In order to avoid any
deserialization
errors with a new version of my class in the future (e.g. when new
attributes, methods etc are added to the class),
I've defined following line of code in my class:
private static final long serialVersionUID = - 2767605614048989439L;
The serialVersionUID was computed using the "serialver" tool.
The JDK version I'm using is: 1.3.1_06-b01
Now my questions:
1) Is the usage of hard coded serialVersionUID an official java feature
to avoid any class versioning problems in the future?
2) Is this mechanism also supported in future versions of JDK? 1.4, 1.5,
etc?
3) Will the alghorithm for the computation for serialVersionUID change
in the future JDK versions?
4) Has anyone made any negative experiences with it? Which problems
might rise up in the future, if the
serialVersionUID is hard coded?
BR
Mohammad
I am writing a program which serializes objects in a file using
ObjectOutputStream and ObjectInputStream. In order to avoid any
deserialization
errors with a new version of my class in the future (e.g. when new
attributes, methods etc are added to the class),
I've defined following line of code in my class:
private static final long serialVersionUID = - 2767605614048989439L;
The serialVersionUID was computed using the "serialver" tool.
The JDK version I'm using is: 1.3.1_06-b01
Now my questions:
1) Is the usage of hard coded serialVersionUID an official java feature
to avoid any class versioning problems in the future?
2) Is this mechanism also supported in future versions of JDK? 1.4, 1.5,
etc?
3) Will the alghorithm for the computation for serialVersionUID change
in the future JDK versions?
4) Has anyone made any negative experiences with it? Which problems
might rise up in the future, if the
serialVersionUID is hard coded?
BR
Mohammad