#302: do not use ReferenceSchema#referredSchema for equals+hashCode#378
#302: do not use ReferenceSchema#referredSchema for equals+hashCode#378tmarsteel wants to merge 7 commits intoeverit-org:masterfrom
Conversation
| return that.canEqual(this) && | ||
| Objects.equals(refValue, that.refValue) && | ||
| Objects.equals(unprocessedProperties, that.unprocessedProperties) && | ||
| Objects.equals(referredSchema, that.referredSchema) && |
There was a problem hiding this comment.
Hello @tmarsteel , do you think we loose anything if we keep this line? So my concern is that, with this change, there can be (rare) cases when two schemas are considered equal when they are not (I mean eg. two references pointing to # , but this denotes the roots of two different schema documents).
What do you think about keeping this line? I see that it might run into infinite equals() recursions, but that's probably a very rare case.
There was a problem hiding this comment.
In the case of Confluent Schema Registry, we call equals quite often on schema. So we would prefer the fix above.
There was a problem hiding this comment.
That's a very good point. The testcase and my actual cyclic schemas both work with referredSchema being included in equals.
|
Hm, this doesn't suffice yet. The |
|
Okay, so it turns out that equals will always cause a stackoverflow when you call it on equal (but not identical) schemas. I have such a cycle in one of my projects, so keeping
|
|
@tmarsteel @erosb We would prefer the fix where If a client wants to additionally compare the In other words, we need one method to avoid the |
This solves Issue #302. Not including the referred schema feels right to me since it depends on the schemaLoader. I have no idea whether people rely on referredSchema being in equals+hashCode, though.