aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/model
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-11-10 11:46:54 +0100
committerGitHub <noreply@github.com>2023-11-10 11:46:54 +0100
commit8e5c63d035ef44a269b8c43430f43f5c8eebfb63 (patch)
tree1b915207b2b9f61951ddbf0ff2e687efd053d555 /core/src/main/kotlin/model
parenta44efd4ba0c2e4ab921ff75e0f53fc9335aa79db (diff)
downloaddokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.gz
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.bz2
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.zip
Restructure the project to utilize included builds (#3174)
* Refactor and simplify artifact publishing * Update Gradle to 8.4 * Refactor and simplify convention plugins and build scripts Fixes #3132 --------- Co-authored-by: Adam <897017+aSemy@users.noreply.github.com> Co-authored-by: Oleg Yukhnevich <whyoleg@gmail.com>
Diffstat (limited to 'core/src/main/kotlin/model')
-rw-r--r--core/src/main/kotlin/model/CompositeSourceSetID.kt46
-rw-r--r--core/src/main/kotlin/model/DisplaySourceSet.kt61
-rw-r--r--core/src/main/kotlin/model/Documentable.kt540
-rw-r--r--core/src/main/kotlin/model/JvmField.kt14
-rw-r--r--core/src/main/kotlin/model/WithChildren.kt98
-rw-r--r--core/src/main/kotlin/model/additionalExtras.kt142
-rw-r--r--core/src/main/kotlin/model/ancestryNode.kt18
-rw-r--r--core/src/main/kotlin/model/classKinds.kt24
-rw-r--r--core/src/main/kotlin/model/defaultValues.kt34
-rw-r--r--core/src/main/kotlin/model/doc/DocTag.kt372
-rw-r--r--core/src/main/kotlin/model/doc/DocumentationNode.kt9
-rw-r--r--core/src/main/kotlin/model/doc/TagWrapper.kt36
-rw-r--r--core/src/main/kotlin/model/documentableProperties.kt71
-rw-r--r--core/src/main/kotlin/model/documentableUtils.kt27
-rw-r--r--core/src/main/kotlin/model/extraModifiers.kt68
-rw-r--r--core/src/main/kotlin/model/jvmName.kt11
-rw-r--r--core/src/main/kotlin/model/properties/PropertyContainer.kt69
-rw-r--r--core/src/main/kotlin/model/properties/properties.kt36
18 files changed, 0 insertions, 1676 deletions
diff --git a/core/src/main/kotlin/model/CompositeSourceSetID.kt b/core/src/main/kotlin/model/CompositeSourceSetID.kt
deleted file mode 100644
index af7d1a5d..00000000
--- a/core/src/main/kotlin/model/CompositeSourceSetID.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.model
-
-import org.jetbrains.dokka.DokkaConfiguration
-import org.jetbrains.dokka.DokkaSourceSetID
-
-/**
- * A unique composite key of multiple [DokkaSourceSetID] that identifies [DisplaySourceSet].
- * Consists of multiple (non-zero) [DokkaSourceSetID] that the corresponding [DisplaySourceSet] was built from.
- *
- * Should not be constructed or copied outside of [DisplaySourceSet] instantiation.
- */
-public data class CompositeSourceSetID(
- private val children: Set<DokkaSourceSetID>
-) {
- public constructor(sourceSetIDs: Iterable<DokkaSourceSetID>) : this(sourceSetIDs.toSet())
- public constructor(sourceSetId: DokkaSourceSetID) : this(setOf(sourceSetId))
-
- init {
- require(children.isNotEmpty()) { "Expected at least one source set id" }
- }
-
- public val merged: DokkaSourceSetID = children.sortedBy { it.scopeId + it.sourceSetName }.let { sortedChildren ->
- DokkaSourceSetID(
- scopeId = sortedChildren.joinToString(separator = "+") { it.scopeId },
- sourceSetName = sortedChildren.joinToString(separator = "+") { it.sourceSetName }
- )
- }
-
- public val all: Set<DokkaSourceSetID> = setOf(merged, *children.toTypedArray())
-
- public operator fun contains(sourceSetId: DokkaSourceSetID): Boolean {
- return sourceSetId in all
- }
-
- public operator fun contains(sourceSet: DokkaConfiguration.DokkaSourceSet): Boolean {
- return sourceSet.sourceSetID in this
- }
-
- public operator fun plus(other: DokkaSourceSetID): CompositeSourceSetID {
- return copy(children = children + other)
- }
-}
diff --git a/core/src/main/kotlin/model/DisplaySourceSet.kt b/core/src/main/kotlin/model/DisplaySourceSet.kt
deleted file mode 100644
index 9d637048..00000000
--- a/core/src/main/kotlin/model/DisplaySourceSet.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.model
-
-import org.jetbrains.dokka.*
-import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
-
-/**
- * Represents a final user-visible source set in the documentable model that is
- * used to specify under which source sets/targets current signatures are available,
- * can be used to filter in and out all available signatures under the specified source set,
- * and, depending on the format, are rendered as "platform" selectors.
- *
- * E.g. HTML format renders display source sets as "bubbles" that later are used for filtering
- * and informational purposes.
- *
- * [DisplaySourceSet]s typically have a one-to-one correspondence to the build system source sets,
- * are created by the base plugin from [DokkaSourceSet] and never tweaked manually.
- * [DisplaySourceSet] is uniquely identified by the corresponding [CompositeSourceSetID].
- *
- * @property sourceSetIDs unique stable id of the display source set.
- * It is composite by definition, as it uniquely defines the source set and all nested source sets.
- * Apart from names, it also contains a substitute to a full source set path in order to differentiate
- * source sets with the same name in a stable manner.
- * @property name corresponds to the name of the original [DokkaSourceSet]
- * @property platform the platform of the source set. If the source set is a mix of multiple source sets
- * that correspond to multiple KMP platforms, then it is [Platform.common]
- */
-public data class DisplaySourceSet(
- val sourceSetIDs: CompositeSourceSetID,
- val name: String,
- val platform: Platform
-) {
- public constructor(sourceSet: DokkaSourceSet) : this(
- sourceSetIDs = CompositeSourceSetID(sourceSet.sourceSetID),
- name = sourceSet.displayName,
- platform = sourceSet.analysisPlatform
- )
-}
-
-/**
- * Transforms the current [DokkaSourceSet] into [DisplaySourceSet],
- * matching the corresponding subset of its properties to [DisplaySourceSet] properties.
- */
-public fun DokkaSourceSet.toDisplaySourceSet(): DisplaySourceSet = DisplaySourceSet(this)
-
-/**
- * Transforms all the given [DokkaSourceSet]s into [DisplaySourceSet]s.
- */
-public fun Iterable<DokkaSourceSet>.toDisplaySourceSets(): Set<DisplaySourceSet> =
- map { it.toDisplaySourceSet() }.toSet()
-
-@InternalDokkaApi
-@Deprecated("Use computeSourceSetIds() and cache its results instead", replaceWith = ReplaceWith("computeSourceSetIds()"))
-public val Iterable<DisplaySourceSet>.sourceSetIDs: List<DokkaSourceSetID> get() = this.flatMap { it.sourceSetIDs.all }
-
-@InternalDokkaApi
-public fun Iterable<DisplaySourceSet>.computeSourceSetIds(): Set<DokkaSourceSetID> =
- fold(hashSetOf()) { acc, set -> acc.addAll(set.sourceSetIDs.all); acc }
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt
deleted file mode 100644
index c6109f47..00000000
--- a/core/src/main/kotlin/model/Documentable.kt
+++ /dev/null
@@ -1,540 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.model
-
-import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
-import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.doc.DocumentationNode
-import org.jetbrains.dokka.model.properties.PropertyContainer
-import org.jetbrains.dokka.model.properties.WithExtraProperties
-
-public interface AnnotationTarget
-
-public abstract class Documentable : WithChildren<Documentable>,
- AnnotationTarget {
- public abstract val name: String?
- public abstract val dri: DRI
- public abstract val documentation: SourceSetDependent<DocumentationNode>
- public abstract val sourceSets: Set<DokkaSourceSet>
- public abstract val expectPresentInSet: DokkaSourceSet?
- abstract override val children: List<Documentable>
-
- override fun toString(): String =
- "${javaClass.simpleName}($dri)"
-
- override fun equals(other: Any?): Boolean =
- other is Documentable && this.dri == other.dri // TODO: https://github.com/Kotlin/dokka/pull/667#discussion_r382555806
-
- override fun hashCode(): Int = dri.hashCode()
-}
-
-public typealias SourceSetDependent<T> = Map<DokkaSourceSet, T>
-
-public interface WithSources {
- public val sources: SourceSetDependent<DocumentableSource>
-}
-
-public interface WithScope {
- public val functions: List<DFunction>
- public val properties: List<DProperty>
- public val classlikes: List<DClasslike>
-}
-
-public interface WithVisibility {
- public val visibility: SourceSetDependent<Visibility>
-}
-
-public interface WithType {
- public val type: Bound
-}
-
-public interface WithAbstraction {
- public val modifier: SourceSetDependent<Modifier>
-}
-
-public sealed class Modifier(
- public val name: String
-)
-
-public sealed class KotlinModifier(name: String) : Modifier(name) {
- public object Abstract : KotlinModifier("abstract")
- public object Open : KotlinModifier("open")
- public object Final : KotlinModifier("final")
- public object Sealed : KotlinModifier("sealed")
- public object Empty : KotlinModifier("")
-}
-
-public sealed class JavaModifier(name: String) : Modifier(name) {
- public object Abstract : JavaModifier("abstract")
- public object Final : JavaModifier("final")
- public object Empty : JavaModifier("")
-}
-
-public interface WithCompanion {
- public val companion: DObject?
-}
-
-public interface WithConstructors {
- public val constructors: List<DFunction>
-}
-
-public interface WithGenerics {
- public val generics: List<DTypeParameter>
-}
-
-public interface WithSupertypes {
- public val supertypes: SourceSetDependent<List<TypeConstructorWithKind>>
-}
-
-public interface WithIsExpectActual {
- public val isExpectActual: Boolean
-}
-
-public interface Callable : WithVisibility, WithType, WithAbstraction, WithSources, WithIsExpectActual {
- public val receiver: DParameter?
-}
-
-public sealed class DClasslike : Documentable(), WithScope, WithVisibility, WithSources, WithIsExpectActual
-
-public data class DModule(
- override val name: String,
- val packages: List<DPackage>,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet? = null,
- override val sourceSets: Set<DokkaSourceSet>,
- override val extra: PropertyContainer<DModule> = PropertyContainer.empty()
-) : Documentable(), WithExtraProperties<DModule> {
- override val dri: DRI = DRI.topLevel
- override val children: List<Documentable>
- get() = packages
-
- override fun withNewExtras(newExtras: PropertyContainer<DModule>): DModule = copy(extra = newExtras)
-}
-
-public data class DPackage(
- override val dri: DRI,
- override val functions: List<DFunction>,
- override val properties: List<DProperty>,
- override val classlikes: List<DClasslike>,
- val typealiases: List<DTypeAlias>,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet? = null,
- override val sourceSets: Set<DokkaSourceSet>,
- override val extra: PropertyContainer<DPackage> = PropertyContainer.empty()
-) : Documentable(), WithScope, WithExtraProperties<DPackage> {
-
- val packageName: String = dri.packageName.orEmpty()
-
- /**
- * !!! WARNING !!!
- * This name is not guaranteed to be a be a canonical/real package name.
- * e.g. this will return a human readable version for root packages.
- * Use [packageName] or `dri.packageName` instead to obtain the real packageName
- */
- override val name: String = packageName.ifBlank { "[root]" }
-
- override val children: List<Documentable> = properties + functions + classlikes + typealiases
-
- override fun withNewExtras(newExtras: PropertyContainer<DPackage>): DPackage = copy(extra = newExtras)
-}
-
-public data class DClass(
- override val dri: DRI,
- override val name: String,
- override val constructors: List<DFunction>,
- override val functions: List<DFunction>,
- override val properties: List<DProperty>,
- override val classlikes: List<DClasslike>,
- override val sources: SourceSetDependent<DocumentableSource>,
- override val visibility: SourceSetDependent<Visibility>,
- override val companion: DObject?,
- override val generics: List<DTypeParameter>,
- override val supertypes: SourceSetDependent<List<TypeConstructorWithKind>>,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet?,
- override val modifier: SourceSetDependent<Modifier>,
- override val sourceSets: Set<DokkaSourceSet>,
- override val isExpectActual: Boolean,
- override val extra: PropertyContainer<DClass> = PropertyContainer.empty()
-) : DClasslike(), WithAbstraction, WithCompanion, WithConstructors, WithGenerics, WithSupertypes,
- WithExtraProperties<DClass> {
-
- override val children: List<Documentable>
- get() = (functions + properties + classlikes + constructors)
-
- override fun withNewExtras(newExtras: PropertyContainer<DClass>): DClass = copy(extra = newExtras)
-}
-
-public data class DEnum(
- override val dri: DRI,
- override val name: String,
- val entries: List<DEnumEntry>,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet?,
- override val sources: SourceSetDependent<DocumentableSource>,
- override val functions: List<DFunction>,
- override val properties: List<DProperty>,
- override val classlikes: List<DClasslike>,
- override val visibility: SourceSetDependent<Visibility>,
- override val companion: DObject?,
- override val constructors: List<DFunction>,
- override val supertypes: SourceSetDependent<List<TypeConstructorWithKind>>,
- override val sourceSets: Set<DokkaSourceSet>,
- override val isExpectActual: Boolean,
- override val extra: PropertyContainer<DEnum> = PropertyContainer.empty()
-) : DClasslike(), WithCompanion, WithConstructors, WithSupertypes, WithExtraProperties<DEnum> {
- override val children: List<Documentable>
- get() = (entries + functions + properties + classlikes + constructors)
-
- override fun withNewExtras(newExtras: PropertyContainer<DEnum>): DEnum = copy(extra = newExtras)
-}
-
-public data class DEnumEntry(
- override val dri: DRI,
- override val name: String,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet?,
- override val functions: List<DFunction>,
- override val properties: List<DProperty>,
- override val classlikes: List<DClasslike>,
- override val sourceSets: Set<DokkaSourceSet>,
- override val extra: PropertyContainer<DEnumEntry> = PropertyContainer.empty()
-) : Documentable(), WithScope, WithExtraProperties<DEnumEntry> {
- override val children: List<Documentable>
- get() = (functions + properties + classlikes)
-
- override fun withNewExtras(newExtras: PropertyContainer<DEnumEntry>): DEnumEntry = copy(extra = newExtras)
-}
-
-public data class DFunction(
- override val dri: DRI,
- override val name: String,
- val isConstructor: Boolean,
- val parameters: List<DParameter>,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet?,
- override val sources: SourceSetDependent<DocumentableSource>,
- override val visibility: SourceSetDependent<Visibility>,
- override val type: Bound,
- override val generics: List<DTypeParameter>,
- override val receiver: DParameter?,
- override val modifier: SourceSetDependent<Modifier>,
- override val sourceSets: Set<DokkaSourceSet>,
- override val isExpectActual: Boolean,
- override val extra: PropertyContainer<DFunction> = PropertyContainer.empty()
-) : Documentable(), Callable, WithGenerics, WithExtraProperties<DFunction> {
- override val children: List<Documentable>
- get() = parameters
-
- override fun withNewExtras(newExtras: PropertyContainer<DFunction>): DFunction = copy(extra = newExtras)
-}
-
-public data class DInterface(
- override val dri: DRI,
- override val name: String,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet?,
- override val sources: SourceSetDependent<DocumentableSource>,
- override val functions: List<DFunction>,
- override val properties: List<DProperty>,
- override val classlikes: List<DClasslike>,
- override val visibility: SourceSetDependent<Visibility>,
- override val companion: DObject?,
- override val generics: List<DTypeParameter>,
- override val supertypes: SourceSetDependent<List<TypeConstructorWithKind>>,
- override val sourceSets: Set<DokkaSourceSet>,
- override val isExpectActual: Boolean,
- override val extra: PropertyContainer<DInterface> = PropertyContainer.empty()
-) : DClasslike(), WithCompanion, WithGenerics, WithSupertypes, WithExtraProperties<DInterface> {
- override val children: List<Documentable>
- get() = (functions + properties + classlikes)
-
- override fun withNewExtras(newExtras: PropertyContainer<DInterface>): DInterface = copy(extra = newExtras)
-}
-
-public data class DObject(
- override val name: String?,
- override val dri: DRI,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet?,
- override val sources: SourceSetDependent<DocumentableSource>,
- override val functions: List<DFunction>,
- override val properties: List<DProperty>,
- override val classlikes: List<DClasslike>,
- override val visibility: SourceSetDependent<Visibility>,
- override val supertypes: SourceSetDependent<List<TypeConstructorWithKind>>,
- override val sourceSets: Set<DokkaSourceSet>,
- override val isExpectActual: Boolean,
- override val extra: PropertyContainer<DObject> = PropertyContainer.empty()
-) : DClasslike(), WithSupertypes, WithExtraProperties<DObject> {
- override val children: List<Documentable>
- get() = (functions + properties + classlikes)
-
- override fun withNewExtras(newExtras: PropertyContainer<DObject>): DObject = copy(extra = newExtras)
-}
-
-public data class DAnnotation(
- override val name: String,
- override val dri: DRI,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet?,
- override val sources: SourceSetDependent<DocumentableSource>,
- override val functions: List<DFunction>,
- override val properties: List<DProperty>,
- override val classlikes: List<DClasslike>,
- override val visibility: SourceSetDependent<Visibility>,
- override val companion: DObject?,
- override val constructors: List<DFunction>,
- override val generics: List<DTypeParameter>,
- override val sourceSets: Set<DokkaSourceSet>,
- override val isExpectActual: Boolean,
- override val extra: PropertyContainer<DAnnotation> = PropertyContainer.empty()
-) : DClasslike(), WithCompanion, WithConstructors, WithExtraProperties<DAnnotation>, WithGenerics {
- override val children: List<Documentable>
- get() = (functions + properties + classlikes + constructors)
-
- override fun withNewExtras(newExtras: PropertyContainer<DAnnotation>): DAnnotation = copy(extra = newExtras)
-}
-
-public data class DProperty(
- override val dri: DRI,
- override val name: String,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet?,
- override val sources: SourceSetDependent<DocumentableSource>,
- override val visibility: SourceSetDependent<Visibility>,
- override val type: Bound,
- override val receiver: DParameter?,
- val setter: DFunction?,
- val getter: DFunction?,
- override val modifier: SourceSetDependent<Modifier>,
- override val sourceSets: Set<DokkaSourceSet>,
- override val generics: List<DTypeParameter>,
- override val isExpectActual: Boolean,
- override val extra: PropertyContainer<DProperty> = PropertyContainer.empty()
-) : Documentable(), Callable, WithExtraProperties<DProperty>, WithGenerics {
- override val children: List<Nothing>
- get() = emptyList()
-
- override fun withNewExtras(newExtras: PropertyContainer<DProperty>): DProperty = copy(extra = newExtras)
-}
-
-// TODO: treat named Parameters and receivers differently
-public data class DParameter(
- override val dri: DRI,
- override val name: String?,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet?,
- override val type: Bound,
- override val sourceSets: Set<DokkaSourceSet>,
- override val extra: PropertyContainer<DParameter> = PropertyContainer.empty()
-) : Documentable(), WithExtraProperties<DParameter>, WithType {
- override val children: List<Nothing>
- get() = emptyList()
-
- override fun withNewExtras(newExtras: PropertyContainer<DParameter>): DParameter = copy(extra = newExtras)
-}
-
-public data class DTypeParameter(
- val variantTypeParameter: Variance<TypeParameter>,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet?,
- val bounds: List<Bound>,
- override val sourceSets: Set<DokkaSourceSet>,
- override val extra: PropertyContainer<DTypeParameter> = PropertyContainer.empty()
-) : Documentable(), WithExtraProperties<DTypeParameter> {
-
- public constructor(
- dri: DRI,
- name: String,
- presentableName: String?,
- documentation: SourceSetDependent<DocumentationNode>,
- expectPresentInSet: DokkaSourceSet?,
- bounds: List<Bound>,
- sourceSets: Set<DokkaSourceSet>,
- extra: PropertyContainer<DTypeParameter> = PropertyContainer.empty()
- ) : this(
- Invariance(TypeParameter(dri, name, presentableName)),
- documentation,
- expectPresentInSet,
- bounds,
- sourceSets,
- extra
- )
-
- override val dri: DRI by variantTypeParameter.inner::dri
- override val name: String by variantTypeParameter.inner::name
-
- override val children: List<Nothing>
- get() = emptyList()
-
- override fun withNewExtras(newExtras: PropertyContainer<DTypeParameter>): DTypeParameter = copy(extra = newExtras)
-}
-
-public data class DTypeAlias(
- override val dri: DRI,
- override val name: String,
- override val type: Bound,
- val underlyingType: SourceSetDependent<Bound>,
- override val visibility: SourceSetDependent<Visibility>,
- override val documentation: SourceSetDependent<DocumentationNode>,
- override val expectPresentInSet: DokkaSourceSet?,
- override val sourceSets: Set<DokkaSourceSet>,
- override val generics: List<DTypeParameter>,
- override val sources: SourceSetDependent<DocumentableSource>,
- override val extra: PropertyContainer<DTypeAlias> = PropertyContainer.empty()
-) : Documentable(), WithType, WithVisibility, WithExtraProperties<DTypeAlias>, WithGenerics, WithSources {
- override val children: List<Nothing>
- get() = emptyList()
-
- override fun withNewExtras(newExtras: PropertyContainer<DTypeAlias>): DTypeAlias = copy(extra = newExtras)
-}
-
-public sealed class Projection
-public sealed class Bound : Projection()
-public data class TypeParameter(
- val dri: DRI,
- val name: String,
- val presentableName: String? = null,
- override val extra: PropertyContainer<TypeParameter> = PropertyContainer.empty()
-) : Bound(), AnnotationTarget, WithExtraProperties<TypeParameter> {
- override fun withNewExtras(newExtras: PropertyContainer<TypeParameter>): TypeParameter =
- copy(extra = extra)
-}
-
-public sealed class TypeConstructor : Bound(), AnnotationTarget {
- public abstract val dri: DRI
- public abstract val projections: List<Projection>
- public abstract val presentableName: String?
-}
-
-public data class GenericTypeConstructor(
- override val dri: DRI,
- override val projections: List<Projection>,
- override val presentableName: String? = null,
- override val extra: PropertyContainer<GenericTypeConstructor> = PropertyContainer.empty()
-) : TypeConstructor(), WithExtraProperties<GenericTypeConstructor> {
- override fun withNewExtras(newExtras: PropertyContainer<GenericTypeConstructor>): GenericTypeConstructor =
- copy(extra = newExtras)
-}
-
-public data class FunctionalTypeConstructor(
- override val dri: DRI,
- override val projections: List<Projection>,
- val isExtensionFunction: Boolean = false,
- val isSuspendable: Boolean = false,
- override val presentableName: String? = null,
- override val extra: PropertyContainer<FunctionalTypeConstructor> = PropertyContainer.empty(),
-) : TypeConstructor(), WithExtraProperties<FunctionalTypeConstructor> {
- override fun withNewExtras(newExtras: PropertyContainer<FunctionalTypeConstructor>): FunctionalTypeConstructor =
- copy(extra = newExtras)
-}
-
-// kotlin.annotation.AnnotationTarget.TYPEALIAS
-public data class TypeAliased(
- val typeAlias: Bound,
- val inner: Bound,
- override val extra: PropertyContainer<TypeAliased> = PropertyContainer.empty()
-) : Bound(), AnnotationTarget, WithExtraProperties<TypeAliased> {
- override fun withNewExtras(newExtras: PropertyContainer<TypeAliased>): TypeAliased =
- copy(extra = newExtras)
-}
-
-public data class PrimitiveJavaType(
- val name: String,
- override val extra: PropertyContainer<PrimitiveJavaType> = PropertyContainer.empty()
-) : Bound(), AnnotationTarget, WithExtraProperties<PrimitiveJavaType> {
- override fun withNewExtras(newExtras: PropertyContainer<PrimitiveJavaType>): PrimitiveJavaType =
- copy(extra = newExtras)
-}
-
-public data class JavaObject(override val extra: PropertyContainer<JavaObject> = PropertyContainer.empty()) :
- Bound(), AnnotationTarget, WithExtraProperties<JavaObject> {
- override fun withNewExtras(newExtras: PropertyContainer<JavaObject>): JavaObject =
- copy(extra = newExtras)
-}
-
-public data class UnresolvedBound(
- val name: String,
- override val extra: PropertyContainer<UnresolvedBound> = PropertyContainer.empty()
-) : Bound(), AnnotationTarget, WithExtraProperties<UnresolvedBound> {
- override fun withNewExtras(newExtras: PropertyContainer<UnresolvedBound>): UnresolvedBound =
- copy(extra = newExtras)
-}
-
-// The following Projections are not AnnotationTargets; they cannot be annotated.
-public data class Nullable(val inner: Bound) : Bound()
-
-/**
- * It introduces [definitely non-nullable types](https://github.com/Kotlin/KEEP/blob/c72601cf35c1e95a541bb4b230edb474a6d1d1a8/proposals/definitely-non-nullable-types.md)
- */
-public data class DefinitelyNonNullable(val inner: Bound) : Bound()
-
-public sealed class Variance<out T : Bound> : Projection() {
- public abstract val inner: T
-}
-
-public data class Covariance<out T : Bound>(override val inner: T) : Variance<T>() {
- override fun toString(): String = "out"
-}
-
-public data class Contravariance<out T : Bound>(override val inner: T) : Variance<T>() {
- override fun toString(): String = "in"
-}
-
-public data class Invariance<out T : Bound>(override val inner: T) : Variance<T>() {
- override fun toString(): String = ""
-}
-
-public object Star : Projection()
-
-public object Void : Bound()
-public object Dynamic : Bound()
-
-public fun Variance<TypeParameter>.withDri(dri: DRI): Variance<TypeParameter> = when (this) {
- is Contravariance -> Contravariance(TypeParameter(dri, inner.name, inner.presentableName))
- is Covariance -> Covariance(TypeParameter(dri, inner.name, inner.presentableName))
- is Invariance -> Invariance(TypeParameter(dri, inner.name, inner.presentableName))
-}
-
-public fun Documentable.dfs(predicate: (Documentable) -> Boolean): Documentable? =
- if (predicate(this)) {
- this
- } else {
- this.children.asSequence().mapNotNull { it.dfs(predicate) }.firstOrNull()
- }
-
-public sealed class Visibility(public val name: String)
-
-public sealed class KotlinVisibility(name: String) : Visibility(name) {
- public object Public : KotlinVisibility("public")
- public object Private : KotlinVisibility("private")
- public object Protected : KotlinVisibility("protected")
- public object Internal : KotlinVisibility("internal")
-}
-
-public sealed class JavaVisibility(name: String) : Visibility(name) {
- public object Public : JavaVisibility("public")
- public object Private : JavaVisibility("private")
- public object Protected : JavaVisibility("protected")
- public object Default : JavaVisibility("")
-}
-
-public fun <T> SourceSetDependent<T>?.orEmpty(): SourceSetDependent<T> = this ?: emptyMap()
-
-public interface DocumentableSource {
- public val path: String
-
- /**
- * Computes the first line number of the documentable's declaration/signature/identifier.
- *
- * Numbering is always 1-based.
- *
- * May return null if the sources could not be found - for example, for synthetic/generated declarations.
- */
- public fun computeLineNumber(): Int?
-}
-
-public data class TypeConstructorWithKind(val typeConstructor: TypeConstructor, val kind: ClassKind)
diff --git a/core/src/main/kotlin/model/JvmField.kt b/core/src/main/kotlin/model/JvmField.kt
deleted file mode 100644
index a2b641c9..00000000
--- a/core/src/main/kotlin/model/JvmField.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.model
-
-import org.jetbrains.dokka.links.DRI
-
-public const val JVM_FIELD_PACKAGE_NAME: String = "kotlin.jvm"
-public const val JVM_FIELD_CLASS_NAMES: String = "JvmField"
-
-public fun DRI.isJvmField(): Boolean = packageName == JVM_FIELD_PACKAGE_NAME && classNames == JVM_FIELD_CLASS_NAMES
-
-public fun Annotations.Annotation.isJvmField(): Boolean = dri.isJvmField()
diff --git a/core/src/main/kotlin/model/WithChildren.kt b/core/src/main/kotlin/model/WithChildren.kt
deleted file mode 100644
index f73a5aa0..00000000
--- a/core/src/main/kotlin/model/WithChildren.kt
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
- */
-
-package org.jetbrains.dokka.model
-
-public interface WithChildren<out T> {
- public val children: List<T>
-}
-
-public inline fun <reified T> WithChildren<*>.firstChildOfTypeOrNull(): T? =
- children.filterIsInstance<T>().firstOrNull()
-
-public inline fun <reified T> WithChildren<*>.firstChildOfTypeOrNull(predicate: (T) -> Boolean): T? =
- children.filterIsInstance<T>().firstOrNull(predicate)
-
-public inline fun <reified T> WithChildren<*>.firstChildOfType(): T =
- children.filterIsInstance<T>().first()
-
-public inline fun <reified T> WithChildren<*>.childrenOfType(): List<T> =
- children.filterIsInstance<T>()
-
-public inline fun <reified T> WithChildren<*>.firstChildOfType(predicate: (T) -> Boolean): T =
- children.filterIsInstance<T>().first(predicate)
-
-public inline fun <reified T> WithChildren<WithChildren<*>>.firstMemberOfType(): T where T : WithChildren<*> {
- return withDescendants().filterIsInstance<T>().first()
-}
-
-public inline fun <reified T> WithChildren<WithChildren<*>>.firstMemberOfType(
- predicate: (T) -> Boolean
-): T where T : WithChildren<*> = withDescendants().filterIsInstance<T>().first(predicate)
-
-
-public inline fun <reified T> WithChildren<WithChildren<*>>.firstMemberOfTypeOrNull(): T? where T : WithChildren<*> {
- return withDescendants().filterIsInstance<T>().firstOrNull()
-}
-
-public fun <T> T.withDescendants(): Sequence<T> where T : WithChildren<T> {
- return sequence {
- yield(this@withDescendants)
- children.forEach { child ->
- yieldAll(child.withDescendants())
- }
- }
-}
-
-@JvmName("withDescendantsProjection")
-public fun WithChildren<*>.withDescendants(): Sequence<Any?> {
- return sequence {
- yield(this@withDescendants)
- children.forEach { child ->
- if (child is WithChildren<*>) {
- yieldAll(child.withDescendants())
- }
- }
- }
-}
-
-@JvmName("withDescendantsAny")
-public fun WithChildren<Any>.withDescendants(): Sequence<Any> {
- return sequence {
- yield(this@withDescendants)
- children.forEach { child ->
- if (child is WithChildren<*>) {
- yieldAll(child.withDescendants().filterNotNull())
- }
- }
- }
-}
-
-public fun <T> T.dfs(predicate: (T) -> Boolean): T