Skip to content

java: Add comparators for comparable objects #312

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

Merged
merged 4 commits into from
Jul 21, 2025
Merged

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented Jul 18, 2025

⚡️ What's your motivation?

Duration, Location and timestamp are comparable. To help sorting these messages a comparator is needed. The alternative would be implementing the Comparable interface, but with generated code that is quite tricky.

Partially resolves: cucumber/cucumber-jvm#3013

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

Duration, Location and timestamp are comparable. To help sorting these
messages a comparator is needed. The alternative would be implementing
the `Comparable` interface, but with generated code that is quite
tricky.
Duration, Location, Timestamp, and TestStepResultStatus are comparable.
To help sorting these messages a comparator is needed. The alternative
would be implementing the `Comparable` interface, but with generated
code that is quite tricky.
@mpkorstanje mpkorstanje marked this pull request as ready for review July 18, 2025 18:33
Copy link
Contributor

@davidjgoss davidjgoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mpkorstanje mpkorstanje merged commit 4d1f036 into main Jul 21, 2025
4 checks passed
@mpkorstanje mpkorstanje deleted the add-comparators branch July 21, 2025 14:37
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.

Messages should interact more gracefully with Java
2 participants