4

If i change this method:

public void setCustom(Map<String, Object> custom) {
    this.custom = (LinkedHashMap<String, Object>)custom;
}

to:

public void setCustom(LinkedHashMap<String, Object> custom) {
    this.custom = custom;
}

do i have to update the serialVersionUID? Is it a compatible change or not?

matteosilv
  • 585
  • 7
  • 13
  • You *never* 'have to update' the `serialVersionUID`, let alone in this case. You haven't changed the serializable fields of the class, at least not from what we've seen here: but the notion that you have to update the `serialVersionUID` when you do is fundamentally flawed. See the ['Object Versioning' chapter of the 'Java Object Serialization Specification'](https://docs.oracle.com/javase/8/docs/platform/serialization/spec/version.html#6678). – user207421 Mar 22 '18 at 10:04

1 Answers1

2

No, the serialization works with class member variables not with methods. For full list of changes that must be taken into account see here.

user207421
  • 305,947
  • 44
  • 307
  • 483
Maciej
  • 1,954
  • 10
  • 14