Skip to content

Add Java equality and hash functions to machines in pobser… #861

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 2 commits into from
May 15, 2025

Conversation

lewisbru
Copy link
Contributor

@lewisbru lewisbru commented May 14, 2025

…ve mode

Generate deepEquals(), equals(), and hashCode() methods in the Java code for machines when compiled in pobserve mode.

…ve mode

Generate deepEquals(), equals(), and hashCode() methods in the Java code for
events and machines when compiled in pobserve mode.
Copy link
Member

@ankushdesai ankushdesai left a comment

Choose a reason for hiding this comment

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

I dont understand why we need these?

Event equality can be done at the base class level itself as it has access to the event name and payload?

I dont think we use machine equality with fields anywhere?

@lewisbru
Copy link
Contributor Author

This is to enable the structural comparison we wanted to add for checker state validation in PObserve.

WriteLine();
WriteLine("public boolean equals(Object other) {");
Write("return this.getClass() == other.getClass()");
if (hasPayload)
Copy link
Member

Choose a reason for hiding this comment

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

May be I am missing something here, why can we not achieve this at the base class level?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My mistake, it looks like it is handled in the base class.

@lewisbru lewisbru changed the title Add Java equality and hash functions to events and machines in pobser… Add Java equality and hash functions to machines in pobser… May 15, 2025
@ankushdesai ankushdesai merged commit ee36fb1 into master May 15, 2025
8 checks passed
@ankushdesai ankushdesai deleted the dev/pobserve-equality-hash branch May 15, 2025 16:01
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.

2 participants