Ethanlm commented on issue #3193: [STORM-3566] add serialVersionUID field to class which implement Serializable URL: https://github.com/apache/storm/pull/3193#issuecomment-577927329 Sorry I have a second thought on this. Although `serialVersionUID` is recommended, we should not add it blindly. `serialVersionUID` should be added where there is a need for backwards compatibility or interoperability. For example, the user defined Bolt/Spout. User defines their own Bolt/Spout and submits the topology over the network to Nimbus. Eventually supervisors will get the assignment and deserialize bolt/spout and put it to work. `serialVersionUID` is recommended in this case because user might submit their topology from a JVM different than where the supervisor is running on (e.g. Oracle vs IBM java). In this case, if `serialVersionUID` is not set, a UID will be generated (say 1234L) and stored in the serialized object. When supervisor tries to deserialize it, because it's running on different JVM, it could generate a different UID for this object (say 3456L), then an `InvalidClassException` would be thrown. Hence we want to declare `serialVersionUID` explicitly to avoid this. But examples like `EventLoggerBolt`, it's only accessed by nimbus or supervisor itself. Not declaring `serialVersionUID` should be just fine. It's almost definitely devs will forget to update `serialVersionUID` manually on the code they changes. Declare `serialVersionUID` explicitly might cause unnecessary trouble. All I am trying to say here is we should think about this carefully and do it case by case. I would like to hear some inputs from @srdo @kishorvpatil too. I feel like this is a more complicated issue than I originally thought. Some useful links: 1) https://www.vojtechruzicka.com/explicitly-declare-serialversionuid/ 2) https://community.sonarsource.com/t/serializable-classes-should-use-auto-generated-version-ids/1217 Thanks for your work on this.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
