From 03329b0eb98b309d208839344052633028e00984 Mon Sep 17 00:00:00 2001 From: Szymon Świstun Date: Wed, 18 Mar 2020 14:19:54 +0100 Subject: Fix minor bugs and add core tests --- core/src/main/kotlin/model/aditionalExtras.kt | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'core/src/main') diff --git a/core/src/main/kotlin/model/aditionalExtras.kt b/core/src/main/kotlin/model/aditionalExtras.kt index b0755759..f7d37111 100644 --- a/core/src/main/kotlin/model/aditionalExtras.kt +++ b/core/src/main/kotlin/model/aditionalExtras.kt @@ -5,22 +5,34 @@ import org.jetbrains.dokka.model.properties.ExtraProperty import org.jetbrains.dokka.model.properties.MergeStrategy class AdditionalModifiers(val content: Set) : ExtraProperty { - object AdditionalKey : ExtraProperty.Key { + companion object : ExtraProperty.Key { override fun mergeStrategyFor( left: AdditionalModifiers, right: AdditionalModifiers ): MergeStrategy = MergeStrategy.Replace(AdditionalModifiers(left.content + right.content)) } - override fun equals(other: Any?): Boolean = if (other is AdditionalModifiers) other.content == content else false + override fun equals(other: Any?): Boolean = + if (other is AdditionalModifiers) other.content == content else false + override fun hashCode() = content.hashCode() - override val key: ExtraProperty.Key = AdditionalKey + override val key: ExtraProperty.Key = AdditionalModifiers } class Annotations(val content: List) : ExtraProperty { - companion object : ExtraProperty.Key + companion object : ExtraProperty.Key { + override fun mergeStrategyFor(left: Annotations, right: Annotations): MergeStrategy = + MergeStrategy.Replace(Annotations((left.content + right.content).distinct())) + } override val key: ExtraProperty.Key = Annotations - data class Annotation(val dri: DRI, val params: Map) + data class Annotation(val dri: DRI, val params: Map) { + override fun equals(other: Any?): Boolean = when(other) { + is Annotation -> dri.equals(other.dri) + else -> false + } + + override fun hashCode(): Int = dri.hashCode() + } } \ No newline at end of file -- cgit