-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Improve NullNode.equals()
#2433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add support for logical equivalence to NullNode (like other node types have) and also equivalence with java null.
Add support for logical equivalence to NullNode (like other node types have) and also equivalence with java null.
|
First of all, no, I do not think |
|
There were two issues I was trying to solve:
|
|
RE: #2, On the other hand you can't say |
|
Ok. I have bit mixed feelings on users being able to create But I don't think public boolean equals(Comparator<JsonNode> comparator, JsonNode other) { ... }should be used for comparisons, and that will allow for custom handling, and was explicitly added to allow use cases like coercions between numeric types and so on. I will go ahead and change |
|
When using lists and maps, the contains() implementation uses the object.equals() call. That's the specific case it would have been handy for. But, since there are other solutions (using |
|
Close at your leisure. Or would you prefer I update the PR? |
|
Ok, so actually creating custom
It is possible to create an instance using reflection (or doing split package) but... not sure anyone has actually used it. Also still don't see why someone would do it; perhaps it is necessary by some mock framework or... |
|
@dsbecker I think I can do that, small enough change. Thank you for asking! |
|
Ah, I hope that ability to create replacements, now, will allow solving that issue. |
|
Ah, I overlooked the combination of final with protected constructor. My bad. |
NullNode.equals()
|
@dsbecker I did too, it looks like. I don't think I meant to leave |
Add support for logical equivalence to NullNode (like other node types have) and also equivalence with java null.