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

api: update Status equals&hashCode #11953

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JoeCqupt
Copy link
Contributor

@JoeCqupt JoeCqupt commented Mar 10, 2025

@JoeCqupt JoeCqupt changed the title update Status equals&hashCode api: update Status equals&hashCode Mar 10, 2025
@JoeCqupt
Copy link
Contributor Author

PTAL @kannanjgithub

@@ -656,8 +656,14 @@ private static String parseAsciiStringSlow(byte[] value) {
* additional fields may be added to Status in the future.
*/
@Override
public boolean equals(Object obj) {
return super.equals(obj);
public boolean equals(Object o) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment suggests to just do comparison on the status code as the description and cause are unlikely to be stable. It may be better to do any handling of the comparison logic at the caller site, i.e., StatusOr.equals in this case. Also whether that comparison should just consider the status code or all 3 fields is another question. I will schedule this for discussion in our next week's API review meeting.

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

Successfully merging this pull request may close these issues.

2 participants