4

If I implement Externalizable, will I need to specify serialVersionUID in that class for version compatibility?

In other words, does Java check serialVersionUID while deserializing Externalizable objects?

shrini1000
  • 7,038
  • 12
  • 59
  • 99
  • Can it even do that (if everything is externalized and nothing serialized)? Where to get the version number from? – Thilo Feb 20 '12 at 08:13
  • Hmm. I guess it could since the object identity is still serialized. – Thilo Feb 20 '12 at 08:15

1 Answers1

4

Even through a class is Externalizable, one still has to add a serialVersionUID member to the class to indicate even though the interface to the class has changed, it is still compatible as far as the serialized or externalized form of the class.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4094702

Low Flying Pelican
  • 5,974
  • 1
  • 32
  • 43
  • According to Hazelcast, in Externalizable it is not needed: https://docs.hazelcast.com/imdg/4.2/serialization/implementing-java-serializable#implementing-java-externalizable – Whimusical Mar 05 '23 at 22:41