Skip to content

Extend SuperEqualsIsObjectEquals to cover hashCode, renaming it to "SuperCallToObjectMethod."#4155

Closed
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_574501701
Closed

Extend SuperEqualsIsObjectEquals to cover hashCode, renaming it to "SuperCallToObjectMethod."#4155
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_574501701

Conversation

@copybara-service
Copy link
Copy Markdown
Contributor

Extend SuperEqualsIsObjectEquals to cover hashCode, renaming it to "SuperCallToObjectMethod."

...as suggested by @Marcono1234 in #4147 (comment).

Also, add docs.

…o "`SuperCallToObjectMethod`."

...as suggested by @Marcono1234 in #4147 (comment).

Also, add docs.

PiperOrigin-RevId: 574501701
if (obj instanceof Foo) {
return super.equals(obj) && id == ((Foo) obj).id;
}
return obj;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
return obj;
return false;

if (obj instanceof Foo) {
return id == ((Foo) obj).id;
}
return obj;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
return obj;
return false;

}
return id.equals(((Foo) obj).id);
}
return obj;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
return obj;
return false;

copybara-service Bot pushed a commit that referenced this pull request Oct 19, 2023
(pointed out [by @Stephan202](#4155 (comment)))

PiperOrigin-RevId: 574976916
@copybara-service copybara-service Bot mentioned this pull request Oct 19, 2023
copybara-service Bot pushed a commit that referenced this pull request Oct 19, 2023
(pointed out [by @Stephan202](#4155 (comment)))

PiperOrigin-RevId: 575004527
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