ARTEMIS-5442 use Objects.equals consistently#5780
Merged
tabish121 merged 1 commit intoapache:mainfrom Jun 23, 2025
Merged
Conversation
tabish121
reviewed
Jun 18, 2025
| @Override | ||
| public int hashCode() { | ||
| return rawValue.hashCode(); | ||
| return Objects.hash(rawValue); |
Contributor
There was a problem hiding this comment.
the Objects.hash() creates an array on each call, is that desirable here vs Objects.hashCode()
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| if (this == |
Contributor
There was a problem hiding this comment.
Formatting change seems wrong here
| return false; | ||
| } | ||
| return true; | ||
| return correlationID == other.correlationID && true; |
Contributor
There was a problem hiding this comment.
I think you can drop the && true here
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| if (this == |
Contributor
There was a problem hiding this comment.
Odd formatting adjustment
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| if (this == |
| public boolean equals(final Object o) { | ||
| if (this == o) { | ||
| public boolean equals(final Object obj) { | ||
| if (this == |
| public boolean equals(final Object o) { | ||
| if (this == o) { | ||
| public boolean equals(final Object obj) { | ||
| if (this == |
| public boolean equals(final Object o) { | ||
| if (this == o) { | ||
| public boolean equals(final Object obj) { | ||
| if (this == |
| @Override | ||
| public boolean equals(final Object o) { | ||
| if (this == o) { | ||
| public boolean equals(final Object obj) { |
| public boolean equals(Object o) { | ||
| if (this == o) | ||
| public boolean equals(Object obj) { | ||
| if (this == |
This commit enforces consistency for `Object#equals` implementations across the code-base via the following changes: - Use `Objects#equals` whenever possible. - Use `instanceof` rather than explicit null checks & `getClass`. - Use "obj" for parameter name and "other" for cast object name. - Always check identity using `==` first. - Use explicit curly brackets for conditionals to increase clarity.
Contributor
Author
|
The commit message should have referenced ARTEMIS-5542. 🤦♂️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit enforces consistency for
Object#equalsimplementations across the code-base via the following changes:Objects#equalswhenever possible.instanceofrather than explicit null checks &getClass.==first.