Fix MemberImpl.equals

This commit is contained in:
Him188 2020-02-21 22:29:17 +08:00
parent 03c6143269
commit b26b3bbfbc

View File

@ -166,7 +166,7 @@ internal class QQImpl(
}
@Suppress("MemberVisibilityCanBePrivate", "DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE")
@Suppress("MemberVisibilityCanBePrivate")
internal class MemberImpl(
qq: QQImpl,
group: GroupImpl,
@ -286,6 +286,20 @@ internal class MemberImpl(
}
}
override fun hashCode(): Int {
var result = bot.hashCode()
result = 31 * result + id.hashCode()
return result
}
@Suppress("DuplicatedCode")
override fun equals(other: Any?): Boolean { // 不要删除. trust me
if (this === other) return true
if (other !is Contact) return false
if (this::class != other::class) return false
return this.id == other.id && this.bot == other.bot
}
override fun toString(): String {
return "Member($id)"
}