Etienne Neveu
Etienne Neveu

Reputation: 12692

Do final modifiers affect Java serialization?

Would adding / removing a final modifier on a field affect Java serialization?

I saw in the java serialization specification that changing the access to a field is a compatible change. But there is no mention of the final modifier, either in the "Incompatible changes" or the "Compatible changes" section.

Is this a compatible change?

Upvotes: 2

Views: 99

Answers (1)

SCouto
SCouto

Reputation: 7928

As long as you were not changing the value of the field yes, it is compatible.

Upvotes: 3

Related Questions