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

Standardize on toString/hash/equals formats #1429

Merged
merged 1 commit into from Mar 8, 2017
Merged

Standardize on toString/hash/equals formats #1429

merged 1 commit into from Mar 8, 2017

Conversation

@ssalinas
Copy link
Member

ssalinas commented Feb 22, 2017

Probably long overdue, but there is a mix of guava, java.util, string concat, etc in our override methods. This changes all of them to java.util.Objects for equals/hashCode and plain string concat for toString. This way there won't be any conflicts when guava changes class/method names etc.

replaces #1425
/cc @stevenschlansker

if (numPorts != resources.numPorts) {
return false;
}
return Double.compare(resources.diskMb, diskMb) == 0;

This comment has been minimized.

Copy link
@darcatron

darcatron Feb 23, 2017

Contributor

is there a reason we broke this apart?

return Objects.hash(createdAt, user, eventType, request, message);
}

@Override
public String toString() {
return "SingularityRequestHistory [createdAt=" + createdAt + ", user=" + user + ", eventType=" + eventType + ", request=" + request + ", message=" + message + "]";
}

This comment has been minimized.

Copy link
@darcatron

darcatron Feb 23, 2017

Contributor

nit: should we switch this to:

"SingularityRequestHistory{" +
"createdAt=" + createdAt + 
", user=" + user + 
", eventType=" + eventType + 
", request=" + request+ 
", message=" + message + 
"}";

to keep the format consistent with the others? Looks like there are a few other places using [] and formatted differently

Standardize on toString/hash/equals formats

further toString unification

missed one more

Fix toString outside of SingularityBase

Fix toString outside of SingularityBase
@ssalinas ssalinas force-pushed the concat branch from 50feadd to d07e783 Feb 27, 2017
@ssalinas
Copy link
Member Author

ssalinas commented Feb 27, 2017

Updated for comments, thanks @darcatron

@darcatron
Copy link
Contributor

darcatron commented Mar 6, 2017

🚢

@ssalinas ssalinas added the hs_stable label Mar 7, 2017
@tpetr

This comment has been minimized.

Copy link
Member

tpetr commented on d07e783 Mar 8, 2017

🚢

@ssalinas ssalinas merged commit e0139cd into master Mar 8, 2017
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@ssalinas ssalinas deleted the concat branch Mar 8, 2017
@ssalinas ssalinas modified the milestone: 0.14.0 Mar 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.