From 7fad444a0c66160833e5af35e654af2df537e9df Mon Sep 17 00:00:00 2001 From: Him188 Date: Tue, 1 Dec 2020 09:22:00 +0800 Subject: [PATCH] Add hashCode and equals to AnsiMessageBuilder --- backend/mirai-console/src/util/AnsiMessageBuilder.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/mirai-console/src/util/AnsiMessageBuilder.kt b/backend/mirai-console/src/util/AnsiMessageBuilder.kt index b36baeb77..5cb0a3839 100644 --- a/backend/mirai-console/src/util/AnsiMessageBuilder.kt +++ b/backend/mirai-console/src/util/AnsiMessageBuilder.kt @@ -114,6 +114,14 @@ public open class AnsiMessageBuilder public constructor( } override fun compareTo(other: AnsiMessageBuilder): Int = this.delegate.compareTo(other.delegate) + override fun hashCode(): Int = this.delegate.hashCode() + override fun equals(other: Any?): Boolean { + if (other == null) return false + if (other::class.java != this::class.java) return false + other as AnsiMessageBuilder + if (other.delegate != this.delegate) return false + return true + } ///////////////////////////////////////////////////////////////////////////////// override fun append(c: Char): AnsiMessageBuilder = apply { delegate.append(c) }