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

Enhance isComparable function for full Comparable interface implementation #700

Closed
GuillermoCasalCaro opened this issue May 23, 2024 · 1 comment · Fixed by #701
Closed
Labels

Comments

@GuillermoCasalCaro
Copy link
Contributor

Hello, this is my first created issue, if there is something wrong just tell me!

The current implementation of the isComparable function only checks if the equals method is present on the object. This is leading me to issues when I'm using a custom Drop class that casually also has an implementation of equals, but I don't want to make it an implementation of the Comparable interface.

When I use the operators <, >, <=, and >= the class is detected as an implementation of Comparable and tries to execute the related functions. This happens in the operator code.

Proposed Solution

Enhance the isComparable function to check for the complete implementation of the Comparable interface, ensuring that the methods equals, gt, geq, lt, and leq are present on the object.

I made a fork and a PR for this. I will link it right now.

Benefits

This will ensure that objects are properly evaluated and that they will use the proper comparison functions, improving the robustness of the template evaluation for the operators <, >, <=, and >=.

Please let me know if this enhancement is acceptable or if there are any changes or additional considerations I should take into account.

Copy link

🎉 This issue has been resolved in version 10.13.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant