Standardize on toString/hash/equals formats #1429

Merged
merged 1 commit into from Mar 8, 2017

Conversation

Projects
None yet
3 participants
@ssalinas
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.

@darcatron

darcatron Feb 23, 2017

Contributor

is there a reason we broke this apart?

@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.

@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

@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

toString updates
Standardize on toString/hash/equals formats

further toString unification

missed one more

Fix toString outside of SingularityBase

Fix toString outside of SingularityBase
@ssalinas

This comment has been minimized.

Show comment
Hide comment
@ssalinas

ssalinas Feb 27, 2017

Member

Updated for comments, thanks @darcatron

Member

ssalinas commented Feb 27, 2017

Updated for comments, thanks @darcatron

@darcatron

This comment has been minimized.

Show comment
Hide comment
@darcatron

darcatron Mar 6, 2017

Contributor

🚢

Contributor

darcatron commented Mar 6, 2017

🚢

@ssalinas ssalinas added the hs_stable label Mar 7, 2017

@tpetr

This comment has been minimized.

Show comment
Hide comment
@tpetr

tpetr Mar 8, 2017

Member

🚢

Member

tpetr commented on d07e783 Mar 8, 2017

🚢

@ssalinas ssalinas merged commit e0139cd into master Mar 8, 2017

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