-
Notifications
You must be signed in to change notification settings - Fork 186
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
Add equals and hashCode to WindowsPrincipal #310
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,4 +255,30 @@ public String toString() { | |
return this.getName(); | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see java.lang.Object#equals(java.lang.Object) | ||
*/ | ||
@Override | ||
public boolean equals(final Object o) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the class be marked as final for immutability? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It appears it could be but that just stops extending it and overriding methods in it. Since it doesn't contain anything to change mutability other than a new instance it's probably ok. I'll have to look further to see why it has two non final fields. Feel free to investigate a bit further. Thanks. Sent from Outlook Mobile On Mon, Jan 11, 2016 at 12:13 PM -0800, "Sergey Podolsky" notifications@github.com wrote:
Shouldn't the class be marked as final for immutability? Reply to this email directly or view it on GitHub: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, what I meant is that inheritance should be forbidden in general on a class that implements equals. One potential problem though is that it can break backwards compatibility for people who mock this class, but I can argue that data types should be stubbed rather than mocked. |
||
if (this == o) { | ||
return true; | ||
} | ||
|
||
if (o instanceof WindowsPrincipal) { | ||
return this.getName().equals(((WindowsPrincipal) o).getName()); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see java.lang.Object#hashCode() | ||
*/ | ||
@Override | ||
public int hashCode() { | ||
return this.getName().hashCode(); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sup with this changelog losing all the convention of having a period at the end and the name of the contributor? Maybe not in this PR, but someone please make it look more consistent :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can look into fixing it. I'd love to automate it. I'll look into that as well. It's otherwise prone to human error ;)
Sent from Outlook Mobile
On Wed, Jan 13, 2016 at 4:08 AM -0800, "Daniel Doubrovkine (dB.) @dblockdotorg" notifications@github.com wrote:
Sup with this changelog losing all the convention of having a period at the end and the name of the contributor? Maybe not in this PR, but someone please make it look more consistent :)
Reply to this email directly or view it on GitHub:
https://github.com/dblock/waffle/pull/310/files#r49582512
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Personally I think automation makes it hard to read. I generally pay a lot of attention to change logs in projects and I want something closer to a human explanation of what has changed. Just my 0.02c.