commons-lang
commons-lang copied to clipboard
[LANG-1705] SerializationUtils.clone() throws a ClassCastException when override writeReplace()
JIRA: https://issues.apache.org/jira/browse/LANG-1705
Due to the possibility that the serialized object type may be a different type after overriding writeReplace(), directly converting the serialized object to the original type(the type of parameter) will result in a ClassCastException.
Fix: Two templates are used for the return value and parameters of SerializationUtils.clone().