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 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;
Copy link
Contributor

@darcatron darcatron Feb 23, 2017

Choose a reason for hiding this comment

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

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 + "]";
}
Copy link
Contributor

@darcatron darcatron Feb 23, 2017

Choose a reason for hiding this comment

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

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
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 merged commit e0139cd into master Mar 8, 2017
2 checks passed
@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants