nativist.bill.cutting
nativist.bill.cutting

Reputation: 1382

How do object / class ids work?

I use the term object / class because I don't understand what it is actually. From course notes:, p33.

Object Versions

The serialization process assigns a version ID to every class. If we change anything about the class, the version ID will change.

The heading does not match the content.

From the code, because the id is created as a static I would assume that it is per class.

But this contradicts the Heading Object Versions. Plus I don't understand how we can change a "class" at run-time.

I think the professor is using the terms object and class interchangeably making things harder to understand.

Is an ID assigned per object or per class?

Upvotes: 2

Views: 88

Answers (1)

user207421
user207421

Reputation: 310980

This confusion stems from the Object Serialization Specification itself, where the relevant chapter was called 'Object Versioning' for years, although they have now belatedly changed it to 'Versioning of Serialized Objects'; and it's riddled throughout this and the Javadoc. It's a common confusion, or sloppiness, and you're quite right to pick it up. Tell your professor!

Upvotes: 2

Related Questions