Nikolay Izhikov created IGNITE-29313:
----------------------------------------

             Summary: ClassesGenerator must check serialVersionUID of abstract 
Serializable classes
                 Key: IGNITE-29313
                 URL: https://issues.apache.org/jira/browse/IGNITE-29313
             Project: Ignite
          Issue Type: Improvement
            Reporter: Nikolay Izhikov


{{ClassesGenerator}} (generates {{classnames.properties}} during ignite-core 
build) fails the build if a {{Serializable}} class has no explicit 
{{serialVersionUID}}, but abstract classes are excluded from the check.

Java serialization writes and checks a class descriptor for *every* 
{{Serializable}} class of the object hierarchy, abstract superclasses included. 
If an abstract class has no explicit {{serialVersionUID}}, JVM computes the 
value from the class signature (name, modifiers, interfaces, fields, 
non-private methods and constructors), so any refactoring of the class silently 
breaks deserialization of all its subclasses written by a previous version, 
even if each subclass has an explicit {{serialVersionUID}}.

This is exactly what happened in IGNITE-29309: computed {{serialVersionUID}} of 
{{BinaryObjectExImpl}} was changed by refactoring between 2.17 and 2.18.

h3. What should be done

# Check abstract classes in {{ClassesGenerator}}, also. Check of the public 
default constructor of {{Externalizable}} must be kept for non-abstract classes 
only.
# Add explicit {{serialVersionUID}} to all abstract {{Serializable}} classes. 
The value must be equal to the one computed by JVM in 2.18.0 to keep 
compatibility with the released version.

26 abstract classes are affected by the check, e.g. 
{{AbstractEvictionPolicyFactory}} (part of {{CacheConfiguration}} that is 
stored with Java serialization), {{TransactionCheckedException}}, 
{{CorruptedDataStructureException}}, {{VisorJob}}, {{VisorMultiNodeTask}}.

Computed value was already changed between 2.18.0 and master for 
{{IgniteConsistencyViolationException}}.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to