Skip to content

Standardize on toString/hash/equals formats#1429

Merged
ssalinas merged 1 commit into
masterfrom
concat
Mar 8, 2017
Merged

Standardize on toString/hash/equals formats#1429
ssalinas merged 1 commit into
masterfrom
concat

Conversation

@ssalinas
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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?


@Override
public String toString() {
return "SingularityRequestHistory [createdAt=" + createdAt + ", user=" + user + ", eventType=" + eventType + ", request=" + request + ", message=" + message + "]";
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.

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
Copy Markdown
Contributor Author

Updated for comments, thanks @darcatron

@matush-v
Copy link
Copy Markdown
Contributor

matush-v commented Mar 6, 2017

🚢

@ssalinas ssalinas merged commit e0139cd into master Mar 8, 2017
@ssalinas ssalinas deleted the concat branch March 8, 2017 15:14
@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.

3 participants