From 0206be47827e5b072dac3deb9ccc1792ba95b13c Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Thu, 18 Jun 2020 12:00:46 +0200 Subject: Javadoc classlikes and function pages All implemented interfaces, first attempt at inherited methods --- core/src/main/kotlin/model/Documentable.kt | 12 ++++++------ core/src/main/kotlin/model/documentableProperties.kt | 17 ++++++++++++++++- core/src/main/kotlin/pages/PageNodes.kt | 4 +--- 3 files changed, 23 insertions(+), 10 deletions(-) (limited to 'core/src') diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index 17b49f97..90958210 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -114,7 +114,7 @@ data class DPackage( ) : Documentable(), WithScope, WithExtraProperties { override val name = dri.packageName.orEmpty() override val children: List - get() = (properties + functions + classlikes) as List + get() = (properties + functions + classlikes) override fun withNewExtras(newExtras: PropertyContainer) = copy(extra = newExtras) } @@ -140,7 +140,7 @@ data class DClass( WithExtraProperties { override val children: List - get() = (functions + properties + classlikes + constructors) as List + get() = (functions + properties + classlikes + constructors) override fun withNewExtras(newExtras: PropertyContainer) = copy(extra = newExtras) } @@ -163,7 +163,7 @@ data class DEnum( override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithCompanion, WithConstructors, WithSupertypes, WithExtraProperties { override val children: List - get() = (entries + functions + properties + classlikes + constructors) as List + get() = (entries + functions + properties + classlikes + constructors) override fun withNewExtras(newExtras: PropertyContainer) = copy(extra = newExtras) } @@ -180,7 +180,7 @@ data class DEnumEntry( override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithScope, WithExtraProperties { override val children: List - get() = (functions + properties + classlikes) as List + get() = (functions + properties + classlikes) override fun withNewExtras(newExtras: PropertyContainer) = copy(extra = newExtras) } @@ -224,7 +224,7 @@ data class DInterface( override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithCompanion, WithGenerics, WithSupertypes, WithExtraProperties { override val children: List - get() = (functions + properties + classlikes) as List + get() = (functions + properties + classlikes) override fun withNewExtras(newExtras: PropertyContainer) = copy(extra = newExtras) } @@ -266,7 +266,7 @@ data class DAnnotation( override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithCompanion, WithConstructors, WithExtraProperties, WithGenerics { override val children: List - get() = (functions + properties + classlikes + constructors) as List + get() = (functions + properties + classlikes + constructors) override fun withNewExtras(newExtras: PropertyContainer) = copy(extra = newExtras) } diff --git a/core/src/main/kotlin/model/documentableProperties.kt b/core/src/main/kotlin/model/documentableProperties.kt index f630ba3b..699a1df1 100644 --- a/core/src/main/kotlin/model/documentableProperties.kt +++ b/core/src/main/kotlin/model/documentableProperties.kt @@ -1,13 +1,28 @@ package org.jetbrains.dokka.model +import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.properties.ExtraProperty import org.jetbrains.dokka.model.properties.MergeStrategy -data class InheritedFunction(val isInherited: Boolean): ExtraProperty { +data class InheritedFunction(val inheritedFrom: DRI?): ExtraProperty { companion object : ExtraProperty.Key { override fun mergeStrategyFor(left: InheritedFunction, right: InheritedFunction) = MergeStrategy.Fail { throw IllegalArgumentException("Function inheritance should be consistent!") } } + + val isInherited: Boolean + get() = inheritedFrom != null + override val key: ExtraProperty.Key = InheritedFunction +} + +data class ImplementedInterfaces(val interfaces: List): ExtraProperty { + companion object : ExtraProperty.Key { + override fun mergeStrategyFor(left: ImplementedInterfaces, right: ImplementedInterfaces) = MergeStrategy.Fail { + throw IllegalArgumentException("Implemented interfaces should be consistent!") + } + } + + override val key: ExtraProperty.Key = ImplementedInterfaces } \ No newline at end of file diff --git a/core/src/main/kotlin/pages/PageNodes.kt b/core/src/main/kotlin/pages/PageNodes.kt index 42ca25cc..b9f1025f 100644 --- a/core/src/main/kotlin/pages/PageNodes.kt +++ b/core/src/main/kotlin/pages/PageNodes.kt @@ -1,9 +1,7 @@ package org.jetbrains.dokka.pages -import org.jetbrains.dokka.DokkaConfiguration -import org.jetbrains.dokka.model.Documentable -import org.jetbrains.dokka.Platform import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.Documentable import java.util.* interface PageNode { -- cgit