From 18dc752c21616306869794306bd0d8b722c85698 Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Mon, 10 Aug 2015 16:22:31 +0300 Subject: [PATCH] Implement hashCode and equals for Module --- .../util/src/org/jetbrains/kotlin/modules/Module.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/compiler/util/src/org/jetbrains/kotlin/modules/Module.kt b/compiler/util/src/org/jetbrains/kotlin/modules/Module.kt index 9b297639f40..a4f2da6b590 100644 --- a/compiler/util/src/org/jetbrains/kotlin/modules/Module.kt +++ b/compiler/util/src/org/jetbrains/kotlin/modules/Module.kt @@ -30,4 +30,15 @@ public interface Module { public fun getAnnotationsRoots(): List public fun getJavaSourceRoots(): List + + override fun equals(other: Any?): Boolean = + when { + this === other -> true + other !is Module -> false + else -> getModuleName() == other.getModuleName() && + getModuleType() == other.getModuleType() + } + + override fun hashCode(): Int = + 31 * getModuleName().hashCode() + getModuleType().hashCode() }