Looking at the implementations of the `canEqual` method in several serializers, 
it seems like all that is done is a check whether the object is of the same 
serializer class.
We’ll have to be careful and double check all `equals` method on serializers 
that may have relied on the `canEqual` method to perform the preliminary type 
Otherwise, this sounds good.

On 16 May 2018 at 4:35:47 PM, Stephan Ewen (se...@apache.org) wrote:

Hi all!  

As part of an attempt to simplify some code in the TypeInfo and  
TypeSerializer area, I would like to drop the "canEqual" methods for the  
following reason:  

"canEqual()" is necessary to make proper equality checks across hierarchies  
of types. This is for example useful in a collection API, stating for  
example whether a List can be equal to a Collection if they have the same  
contents. We don't have that here.  

A certain type information (and serializer) is equal to another one if they  
describe the same type, strictly. There is no necessity for cross hierarchy  

This has also let to the situation that most type infos and serializers  
implement just a dummy/default version of "canEqual". Many "equals()"  
methods do not even call the other object's "canEqual", etc.  

As a first step, we could simply deprecate the method and implement an  
empty default, and remove all calls to that method.  


Reply via email to