From ca4107b4760d26a3ed38e220a9dd80888b95d78c Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 10 Sep 2020 20:55:08 +0800 Subject: [PATCH] Fix PermissionImpl.equals, PermissionImpl.hashCode, PermissionImpl.toString --- .../mirai/console/permission/BuiltInPermissionServices.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/BuiltInPermissionServices.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/BuiltInPermissionServices.kt index 647399841..c1c3918e2 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/BuiltInPermissionServices.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/permission/BuiltInPermissionServices.kt @@ -152,7 +152,7 @@ internal data class PermissionImpl @Deprecated("Only for Root") constructor( if (id != other.id) return false if (description != other.description) return false - if (parent != other.parent) return false + if (parent !== other.parent) return false return true } @@ -160,9 +160,10 @@ internal data class PermissionImpl @Deprecated("Only for Root") constructor( override fun hashCode(): Int { var result = id.hashCode() result = 31 * result + description.hashCode() - result = 31 * result + parent.hashCode() + result = 31 * result + if (parent == this) 1 else parent.hashCode() return result } - override fun toString(): String = "PermissionImpl(id=$id, description='$description', parentId=$parent)" + override fun toString(): String = + "PermissionImpl(id=$id, description='$description', parent=${if (parent === this) "" else parent.toString()})" } \ No newline at end of file