Skip to content

Commit

Permalink
Fix symmetricity of CustomEmojiImpl/RichCustomEmojiImpl#equals (#2519)
Browse files Browse the repository at this point in the history
  • Loading branch information
danthe1st authored Aug 14, 2023
1 parent 72aaf10 commit 79b1b56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public String getFormatted()
@Override
public int hashCode()
{
return Objects.hash(name, id, animated);
return Long.hashCode(id);
}

@Override
Expand All @@ -101,7 +101,7 @@ public boolean equals(Object obj)
if (!(obj instanceof CustomEmoji))
return false;
CustomEmoji other = (CustomEmoji) obj;
return other.getIdLong() == id;
return this.id == other.getIdLong();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ public boolean equals(Object obj)
{
if (obj == this)
return true;
if (!(obj instanceof RichCustomEmojiImpl))
if (!(obj instanceof CustomEmoji))
return false;

RichCustomEmojiImpl other = (RichCustomEmojiImpl) obj;
return this.id == other.id && getName().equals(other.getName());
CustomEmoji other = (CustomEmoji) obj;
return this.id == other.getIdLong();
}


Expand Down

0 comments on commit 79b1b56

Please sign in to comment.