aboutsummaryrefslogtreecommitdiff
path: root/core/src/main
diff options
context:
space:
mode:
authorSzymon Świstun <sswistun@virtuslab.com>2020-03-18 14:19:54 +0100
committerKamil Doległo <kamilok1965@users.noreply.github.com>2020-03-18 14:22:56 +0100
commit03329b0eb98b309d208839344052633028e00984 (patch)
treefb41aef63553562fe48e9ef39f9efe7f5824db71 /core/src/main
parent9ac39176bee7c104ff350f968ee399ac97809ad9 (diff)
downloaddokka-03329b0eb98b309d208839344052633028e00984.tar.gz
dokka-03329b0eb98b309d208839344052633028e00984.tar.bz2
dokka-03329b0eb98b309d208839344052633028e00984.zip
Fix minor bugs and add core tests
Diffstat (limited to 'core/src/main')
-rw-r--r--core/src/main/kotlin/model/aditionalExtras.kt22
1 files changed, 17 insertions, 5 deletions
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<ExtraModifiers>) : ExtraProperty<Documentable> {
- object AdditionalKey : ExtraProperty.Key<Documentable, AdditionalModifiers> {
+ companion object : ExtraProperty.Key<Documentable, AdditionalModifiers> {
override fun mergeStrategyFor(
left: AdditionalModifiers,
right: AdditionalModifiers
): MergeStrategy<Documentable> = 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<Documentable, *> = AdditionalKey
+ override val key: ExtraProperty.Key<Documentable, *> = AdditionalModifiers
}
class Annotations(val content: List<Annotation>) : ExtraProperty<Documentable> {
- companion object : ExtraProperty.Key<Documentable, Annotations>
+ companion object : ExtraProperty.Key<Documentable, Annotations> {
+ override fun mergeStrategyFor(left: Annotations, right: Annotations): MergeStrategy<Documentable> =
+ MergeStrategy.Replace(Annotations((left.content + right.content).distinct()))
+ }
override val key: ExtraProperty.Key<Documentable, *> = Annotations
- data class Annotation(val dri: DRI, val params: Map<String, String>)
+ data class Annotation(val dri: DRI, val params: Map<String, String>) {
+ 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