-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
com.google.common.collect.Range#hasLowerBound determination error after deserialization #7150
Comments
Since |
ex: |
If |
If I need to pass the Range type when requesting the external interface, I first need to serialize the Range into JSON and send it to the server. Upon receiving the JSON, the server needs to deserialize it to obtain the correct Range type and perform the corresponding logical processing. However, this scenario becomes impractical because the deserialization process requires the object to be regenerated |
It sounds like |
This workaround may necessitate extra effort from the user. I think as a tool class, it is crucial to consider its convenience for users across different scenarios and its compatibility with various use cases. |
Reflection is definitely sometimes a quick way to get things working. However, since it depends on the implementation details of the library you're reflecting on, it often leads to breakages down the line. (For example, it's usually one of the main obstacles to JDK upgrades.) So the convenience and compatibility today may lead to inconvenience and incompatibility later on. |
Description
after I serialize a Range object, I get the Range object through json deserialization. The new Range object hasLowerBound returns true. Because the judgment of this method is lowerBound != Cut.belowAll()
Example
Expected Behavior
assertFalse(range2.hasLowerBound());
assertFalse(deserializeRange2.hasLowerBound());
Actual Behavior
assertFalse(range2.hasLowerBound());
assertTrue(deserializeRange2.hasLowerBound());
Packages
com.google.common.collect
Platforms
No response
Checklist
The text was updated successfully, but these errors were encountered: