Skip to content
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

Back port fix json object#equals method fails when comparing integers with floats #5193

Conversation

sai-manohar-veerubhotla
Copy link
Contributor

Motivation:
The motivation is to fix the bug: #5185

Context:
The current implementation of JsonObject#equals fails to equate numeric types correctly, leading to false comparisons:

2f is not considered equal to 2.
2D is not considered equal to 2.
Changes:
This PR updates JsonObject#equals to correctly handle comparisons between different numeric types (float, double, intege, long), ensuring logical equivalence where expected. Additionally, new assertions have been added to JsonObjectTest#testNumberEquality to validate these changes.

This PR tries to fix exactly the same by modifying the JsonObject#equals. Adds new assertions to JsonObjectTest#testNumberEquality.

Context:
The current implementation of JsonObject#equals fails to equate numeric types correctly, leading to false comparisons:
1. `2f` is not considered equal to `2`.
2. `2D` is not considered equal to `2`.

Changes:
This PR updates JsonObject#equals to correctly handle comparisons between different numeric types (float, double, intege, long), ensuring logical equivalence where expected.
Additionally, new assertions have been added to JsonObjectTest#testNumberEquality to validate these changes.

This PR tries to fix exactly the same by modifying the JsonObject#equals.
Adds new assertions to JsonObjectTest#testNumberEquality.
…with-floats

Context:
The current implementation of JsonObject#equals fails to equate numeric types correctly, leading to false comparisons:
1. `2f` is not considered equal to `2`.
2. `2D` is not considered equal to `2`.

Changes:
This PR updates JsonObject#equals to correctly handle comparisons between different numeric types (float, double, intege, long), ensuring logical equivalence where expected.
Additionally, new assertions have been added to JsonObjectTest#testNumberEquality to validate these changes.

This PR tries to fix exactly the same by modifying the JsonObject#equals.
Adds new assertions to JsonObjectTest#testNumberEquality.
@vietj vietj added this to the 4.5.8 milestone Apr 29, 2024
@vietj vietj merged commit 511de8b into eclipse-vertx:4.x Apr 29, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants