-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Shouldn't Long and Int Nodes be equivalent? #333
Comments
Equality in Java is very tricky to get right, and unfortunately I am not sure what the right answer is there. One can certainly argue that comparison for special case of The idea about coercing creation of As to other parts; when constructing trees from I think this is something that might be good to discuss on jackson-dev list: there are others who have keen interest in tree model and especially numeric aspects. I am not the supreme authority in this particular part, even though I have done most changes. :) |
Quick note: construction of canonical I will make one immediate change, such that default Regarding equality; the reason I think this can not be solved well with any |
I think your suggested change to |
One more note: #790 addresses the equality question as well, allowing bit simpler external/custom equality comparison. |
Actually, no. I have to contradict myself and claim that it does not make sense to add such logic into This should not lead to changes in actual |
Come to think of it, I won't add a configuration method. It is easy enough to sub-class factory, add functionality that way; and adding more state into base implementation seems like a wrong idea due to extensive sharing of the default node factory. |
If I build an ObjectNode with small "Long" or "long" values, I cannot round trip the the node into an equivalent node.
Shouldn't the same logic that is used when deserializing the String be used when creating the tree? If I pass in a long value that will fit in an int, why not create an IntNode? Is there a way for me to access this logic when I'm creating a tree? Is there a way to force a tree into a canonical representation that can be compared against another tree? Is there a method besides "equals" that compares two trees as JSON entities and not Maps and Lists of Java Objects?
The text was updated successfully, but these errors were encountered: