Details
-
Bug
-
Status: Open
-
P3
-
Resolution: Unresolved
-
None
-
None
Description
Specifically, types which don't implement an equals method (or more loosely, types which use the Object equals method) should either implement #structuralValue via using encoded bytes, or require the use of an Equivalence (like the guava definition).
It should always be that the following snippet (or its approximation) returns true:
<T> expected(Coder<T> myCoder, T myElement)
byte[] elementBytes = CoderUtils.serializeToByteArray(myCoder, myElement);
T decodedFirst = CoderUtils.deserializeFromByteArray(myCoder, elementBytes);
T decodedSecond = CoderUtils.deserializeFromByteArray(myCoder, elementBytes);
myCoder.structuralValue(decodedFirst).equals(myCoder.structuralValue(decodedScond));