aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-03-16 14:33:38 +0100
committerKamil Doległo <kamilok1965@users.noreply.github.com>2020-03-16 14:35:12 +0100
commit996feefe717ac623daabaadda71b5b9d2bbe1cf1 (patch)
treefca8d99c2cf4f9dcc64159b4e1ebe5644f2bd81b /plugins/base/src/main/kotlin
parentcd38992a28a8b16cd91661f05829610d1373e47c (diff)
downloaddokka-996feefe717ac623daabaadda71b5b9d2bbe1cf1.tar.gz
dokka-996feefe717ac623daabaadda71b5b9d2bbe1cf1.tar.bz2
dokka-996feefe717ac623daabaadda71b5b9d2bbe1cf1.zip
Rename Documentables to avoid name conflicts
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt4
-rw-r--r--plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt35
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt116
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt78
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultDocumentableToPageTranslator.kt4
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt18
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt40
7 files changed, 146 insertions, 149 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index d7b2a912..34dac9f4 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -4,7 +4,7 @@ import kotlinx.html.*
import kotlinx.html.stream.createHTML
import org.jetbrains.dokka.base.renderers.DefaultRenderer
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
import java.io.File
@@ -269,7 +269,7 @@ private fun PageNode.pageKind() = when (this) {
is PackagePageNode -> "package"
is ClasslikePageNode -> "class"
is MemberPageNode -> when (this.documentable) {
- is Function -> "function"
+ is DFunction -> "function"
else -> "other"
}
else -> "other"
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
index f600a3bf..8a080bb9 100644
--- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
+++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
@@ -6,12 +6,11 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.DriOfUnit
import org.jetbrains.dokka.links.sureClassNames
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Annotation
-import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DAnnotation
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.pages.ContentKind
import org.jetbrains.dokka.pages.ContentNode
-import org.jetbrains.dokka.pages.PlatformData
import org.jetbrains.dokka.pages.TextStyle
import org.jetbrains.dokka.utilities.DokkaLogger
@@ -21,26 +20,26 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
private val ignoredVisibilities = setOf(JavaVisibility.Default, KotlinVisibility.Public)
override fun signature(documentable: Documentable): ContentNode = when (documentable) {
- is Function -> signature(documentable)
- is Property -> signature(documentable)
- is Classlike -> signature(documentable)
- is TypeParameter -> signature(documentable)
+ is DFunction -> signature(documentable)
+ is DProperty -> signature(documentable)
+ is DClasslike -> signature(documentable)
+ is DTypeParameter -> signature(documentable)
else -> throw NotImplementedError(
"Cannot generate signature for ${documentable::class.qualifiedName} ${documentable.name}"
)
}
- private fun signature(c: Classlike) = contentBuilder.contentFor(c, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
+ private fun signature(c: DClasslike) = contentBuilder.contentFor(c, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
platformText(c.visibility) { (it.takeIf { it !in ignoredVisibilities }?.name ?: "") + " " }
- if (c is Class) {
+ if (c is DClass) {
text(c.modifier.name + " ")
}
when (c) {
- is Class -> text("class ")
- is Interface -> text("interface ")
- is Enum -> text("enum ")
- is Object -> text("object ")
- is Annotation -> text("annotation class ")
+ is DClass -> text("class ")
+ is DInterface -> text("interface ")
+ is DEnum -> text("enum ")
+ is DObject -> text("object ")
+ is DAnnotation -> text("annotation class ")
}
link(c.name!!, c.dri)
if (c is WithSupertypes) {
@@ -52,11 +51,11 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
}
}
- private fun signature(p: Property) = contentBuilder.contentFor(p, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
+ private fun signature(p: DProperty) = contentBuilder.contentFor(p, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
signatureForProjection(p.type)
}
- private fun signature(f: Function) = contentBuilder.contentFor(f, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
+ private fun signature(f: DFunction) = contentBuilder.contentFor(f, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
platformText(f.visibility) { (it.takeIf { it !in ignoredVisibilities }?.name ?: "") + " " }
text(f.modifier.name + " ")
text("fun ")
@@ -82,7 +81,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
}
}
- private fun signature(t: TypeParameter) = contentBuilder.contentFor(t) {
+ private fun signature(t: DTypeParameter) = contentBuilder.contentFor(t) {
link(t.name, t.dri)
list(t.bounds, prefix = " : ") {
signatureForProjection(it)
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
index 4d47401b..bb7dbaaf 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
@@ -1,10 +1,10 @@
package org.jetbrains.dokka.base.transformers.documentables
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.Function
-import org.jetbrains.dokka.model.Package
-import org.jetbrains.dokka.model.Annotation
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DFunction
+import org.jetbrains.dokka.model.DPackage
+import org.jetbrains.dokka.model.DAnnotation
import org.jetbrains.dokka.model.properties.mergeExtras
import org.jetbrains.dokka.pages.PlatformData
import org.jetbrains.dokka.plugability.DokkaContext
@@ -12,7 +12,7 @@ import org.jetbrains.dokka.transformers.documentation.DocumentableMerger
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
internal object DefaultDocumentableMerger : DocumentableMerger {
- override fun invoke(modules: Collection<Module>, context: DokkaContext): Module {
+ override fun invoke(modules: Collection<DModule>, context: DokkaContext): DModule {
val name = modules.map { it.name }.distinct().singleOrNull() ?: run {
context.logger.error("All module names need to be the same")
modules.first().name
@@ -21,11 +21,11 @@ internal object DefaultDocumentableMerger : DocumentableMerger {
return modules.reduce { left, right ->
val list = listOf(left, right)
- Module(
+ DModule(
name = name,
packages = merge(
list.flatMap { it.packages },
- Package::mergeWith
+ DPackage::mergeWith
),
documentation = list.platformDependentFor { documentation },
platformData = list.flatMap { it.platformData }.distinct()
@@ -106,25 +106,25 @@ private sealed class Expect<out T : Any> {
}
}
-fun Package.mergeWith(other: Package): Package = copy(
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+fun DPackage.mergeWith(other: DPackage): DPackage = copy(
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
documentation = documentation.mergeWith(other.documentation),
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun Function.mergeWith(other: Function): Function = copy(
- parameters = merge(this.parameters + other.parameters, Parameter::mergeWith),
+fun DFunction.mergeWith(other: DFunction): DFunction = copy(
+ parameters = merge(this.parameters + other.parameters, DParameter::mergeWith),
receiver = receiver?.let { r -> other.receiver?.let { r.mergeWith(it) } ?: r } ?: other.receiver,
documentation = documentation.mergeWith(other.documentation),
sources = sources.mergeWith(other.sources),
visibility = visibility.mergeWith(other.visibility),
platformData = (platformData + other.platformData).distinct(),
- generics = merge(generics + other.generics, TypeParameter::mergeWith)
+ generics = merge(generics + other.generics, DTypeParameter::mergeWith)
).mergeExtras(this, other)
-fun Property.mergeWith(other: Property): Property = copy(
+fun DProperty.mergeWith(other: DProperty): DProperty = copy(
receiver = receiver?.let { r -> other.receiver?.let { r.mergeWith(it) } ?: r } ?: other.receiver,
documentation = documentation.mergeWith(other.documentation),
sources = sources.mergeWith(other.sources),
@@ -134,33 +134,33 @@ fun Property.mergeWith(other: Property): Property = copy(
setter = setter?.let { s -> other.setter?.let { s.mergeWith(it) } ?: s } ?: other.setter
).mergeExtras(this, other)
-fun Classlike.setPlatformData(platformData: List<PlatformData>): Classlike = when (this) {
- is Class -> copy(platformData = platformData)
- is Enum -> copy(platformData = platformData)
- is Interface -> copy(platformData = platformData)
- is Object -> copy(platformData = platformData)
+fun DClasslike.setPlatformData(platformData: List<PlatformData>): DClasslike = when (this) {
+ is DClass -> copy(platformData = platformData)
+ is DEnum -> copy(platformData = platformData)
+ is DInterface -> copy(platformData = platformData)
+ is DObject -> copy(platformData = platformData)
else -> throw IllegalStateException("${this::class.qualifiedName} ${this.name} cannot have platform set")
}
-fun Classlike.mergeWith(other: Classlike): Classlike = when {
- this is Class && other is Class -> mergeWith(other)
- this is Enum && other is Enum -> mergeWith(other)
- this is Interface && other is Interface -> mergeWith(other)
- this is Object && other is Object -> mergeWith(other)
- this is Annotation && other is Annotation -> mergeWith(other)
+fun DClasslike.mergeWith(other: DClasslike): DClasslike = when {
+ this is DClass && other is DClass -> mergeWith(other)
+ this is DEnum && other is DEnum -> mergeWith(other)
+ this is DInterface && other is DInterface -> mergeWith(other)
+ this is DObject && other is DObject -> mergeWith(other)
+ this is DAnnotation && other is DAnnotation -> mergeWith(other)
else -> throw IllegalStateException("${this::class.qualifiedName} ${this.name} cannot be mergesd with ${other::class.qualifiedName} ${other.name}")
}
-fun Class.mergeWith(other: Class): Class = copy(
+fun DClass.mergeWith(other: DClass): DClass = copy(
constructors = mergeExpectActual(
constructors + other.constructors,
- Function::mergeWith
+ DFunction::mergeWith
) { copy(platformData = it) },
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
companion = companion?.let { c -> other.companion?.let { c.mergeWith(it) } ?: c } ?: other.companion,
- generics = merge(generics + other.generics, TypeParameter::mergeWith),
+ generics = merge(generics + other.generics, DTypeParameter::mergeWith),
supertypes = supertypes.mergeWith(other.supertypes),
documentation = documentation.mergeWith(other.documentation),
sources = sources.mergeWith(other.sources),
@@ -168,15 +168,15 @@ fun Class.mergeWith(other: Class): Class = copy(
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun Enum.mergeWith(other: Enum): Enum = copy(
- entries = merge(entries + other.entries, EnumEntry::mergeWith),
+fun DEnum.mergeWith(other: DEnum): DEnum = copy(
+ entries = merge(entries + other.entries, DEnumEntry::mergeWith),
constructors = mergeExpectActual(
constructors + other.constructors,
- Function::mergeWith
+ DFunction::mergeWith
) { copy(platformData = it) },
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
companion = companion?.let { c -> other.companion?.let { c.mergeWith(it) } ?: c } ?: other.companion,
supertypes = supertypes.mergeWith(other.supertypes),
documentation = documentation.mergeWith(other.documentation),
@@ -185,18 +185,18 @@ fun Enum.mergeWith(other: Enum): Enum = copy(
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun EnumEntry.mergeWith(other: EnumEntry): EnumEntry = copy(
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+fun DEnumEntry.mergeWith(other: DEnumEntry): DEnumEntry = copy(
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
documentation = documentation.mergeWith(other.documentation),
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun Object.mergeWith(other: Object): Object = copy(
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+fun DObject.mergeWith(other: DObject): DObject = copy(
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
supertypes = supertypes.mergeWith(other.supertypes),
documentation = documentation.mergeWith(other.documentation),
sources = sources.mergeWith(other.sources),
@@ -204,12 +204,12 @@ fun Object.mergeWith(other: Object): Object = copy(
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun Interface.mergeWith(other: Interface): Interface = copy(
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+fun DInterface.mergeWith(other: DInterface): DInterface = copy(
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
companion = companion?.let { c -> other.companion?.let { c.mergeWith(it) } ?: c } ?: other.companion,
- generics = merge(generics + other.generics, TypeParameter::mergeWith),
+ generics = merge(generics + other.generics, DTypeParameter::mergeWith),
supertypes = supertypes.mergeWith(other.supertypes),
documentation = documentation.mergeWith(other.documentation),
sources = sources.mergeWith(other.sources),
@@ -217,14 +217,14 @@ fun Interface.mergeWith(other: Interface): Interface = copy(
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun Annotation.mergeWith(other: Annotation): Annotation = copy(
+fun DAnnotation.mergeWith(other: DAnnotation): DAnnotation = copy(
constructors = mergeExpectActual(
constructors + other.constructors,
- Function::mergeWith
+ DFunction::mergeWith
) { copy(platformData = it) },
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
companion = companion?.let { c -> other.companion?.let { c.mergeWith(it) } ?: c } ?: other.companion,
documentation = documentation.mergeWith(other.documentation),
sources = sources.mergeWith(other.sources),
@@ -232,12 +232,12 @@ fun Annotation.mergeWith(other: Annotation): Annotation = copy(
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun Parameter.mergeWith(other: Parameter): Parameter = copy(
+fun DParameter.mergeWith(other: DParameter): DParameter = copy(
documentation = documentation.mergeWith(other.documentation),
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun TypeParameter.mergeWith(other: TypeParameter): TypeParameter = copy(
+fun DTypeParameter.mergeWith(other: DTypeParameter): DTypeParameter = copy(
documentation = documentation.mergeWith(other.documentation),
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other) \ No newline at end of file
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index 9a71145f..eb23ffd7 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -5,8 +5,8 @@ import org.jetbrains.dokka.links.Callable
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.withClass
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.PlatformData
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorVisitorEmptyBo
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.calls.components.isVararg
import org.jetbrains.kotlin.resolve.calls.tasks.isDynamic
-import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.descriptorUtil.getAllSuperclassesWithoutAny
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassNotAny
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperInterfaces
@@ -30,7 +29,6 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeProjection
import org.jetbrains.dokka.model.Variance
-import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf.fqName
import org.jetbrains.kotlin.idea.kdoc.findKDoc
class DefaultDescriptorToDocumentableTranslator(
@@ -47,7 +45,7 @@ class DefaultDescriptorToDocumentableTranslator(
DRIWithPlatformInfo(DRI.topLevel, PlatformDependent.empty())
)
}
- }.let { Module(moduleName, it, PlatformDependent.empty(), listOf(platformData)) }
+ }.let { DModule(moduleName, it, PlatformDependent.empty(), listOf(platformData)) }
}
@@ -69,11 +67,11 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
override fun visitPackageFragmentDescriptor(
descriptor: PackageFragmentDescriptor,
parent: DRIWithPlatformInfo
- ): Package {
+ ): DPackage {
val driWithPlatform = DRI(packageName = descriptor.fqName.asString()).withEmptyInfo()
val scope = descriptor.getMemberScope()
- return Package(
+ return DPackage(
dri = driWithPlatform.dri,
functions = scope.functions(driWithPlatform),
properties = scope.properties(driWithPlatform),
@@ -83,7 +81,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- override fun visitClassDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): Classlike =
+ override fun visitClassDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): DClasslike =
when (descriptor.kind) {
ClassKind.ENUM_CLASS -> enumDescriptor(descriptor, parent)
ClassKind.OBJECT -> objectDescriptor(descriptor, parent)
@@ -91,12 +89,12 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
else -> classDescriptor(descriptor, parent)
}
- private fun interfaceDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): Interface {
+ private fun interfaceDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): DInterface {
val driWithPlatform = parent.dri.withClass(descriptor.name.asString()).withEmptyInfo()
val scope = descriptor.unsubstitutedMemberScope
val info = descriptor.resolveClassDescriptionData(platformData)
- return Interface(
+ return DInterface(
dri = driWithPlatform.dri,
name = descriptor.name.asString(),
functions = scope.functions(driWithPlatform),
@@ -113,12 +111,12 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- private fun objectDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): Object {
+ private fun objectDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): DObject {
val driWithPlatform = parent.dri.withClass(descriptor.name.asString()).withEmptyInfo()
val scope = descriptor.unsubstitutedMemberScope
val info = descriptor.resolveClassDescriptionData(platformData)
- return Object(
+ return DObject(
dri = driWithPlatform.dri,
name = descriptor.name.asString(),
functions = scope.functions(driWithPlatform),
@@ -133,12 +131,12 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- private fun enumDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): Enum {
+ private fun enumDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): DEnum {
val driWithPlatform = parent.dri.withClass(descriptor.name.asString()).withEmptyInfo()
val scope = descriptor.unsubstitutedMemberScope
val info = descriptor.resolveClassDescriptionData(platformData)
- return Enum(
+ return DEnum(
dri = driWithPlatform.dri,
name = descriptor.name.asString(),
entries = scope.enumEntries(driWithPlatform),
@@ -156,11 +154,11 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- private fun enumEntryDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): EnumEntry {
+ private fun enumEntryDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): DEnumEntry {
val driWithPlatform = parent.dri.withClass(descriptor.name.asString()).withEmptyInfo()
val scope = descriptor.unsubstitutedMemberScope
- return EnumEntry(
+ return DEnumEntry(
dri = driWithPlatform.dri,
name = descriptor.name.asString(),
documentation = descriptor.resolveDescriptorData(platformData),
@@ -172,13 +170,13 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- private fun classDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): Class {
+ private fun classDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): DClass {
val driWithPlatform = parent.dri.withClass(descriptor.name.asString()).withEmptyInfo()
val scope = descriptor.unsubstitutedMemberScope
val info = descriptor.resolveClassDescriptionData(platformData)
val actual = descriptor.createSources()
- return Class(
+ return DClass(
dri = driWithPlatform.dri,
name = descriptor.name.asString(),
constructors = descriptor.constructors.map {
@@ -203,11 +201,11 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- override fun visitPropertyDescriptor(descriptor: PropertyDescriptor, parent: DRIWithPlatformInfo): Property {
+ override fun visitPropertyDescriptor(descriptor: PropertyDescriptor, parent: DRIWithPlatformInfo): DProperty {
val dri = parent.dri.copy(callable = Callable.from(descriptor))
val actual = descriptor.createSources()
- return Property(
+ return DProperty(
dri = dri,
name = descriptor.name.asString(),
receiver = descriptor.extensionReceiverParameter?.let {
@@ -229,11 +227,11 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- override fun visitFunctionDescriptor(descriptor: FunctionDescriptor, parent: DRIWithPlatformInfo): Function {
+ override fun visitFunctionDescriptor(descriptor: FunctionDescriptor, parent: DRIWithPlatformInfo): DFunction {
val dri = parent.dri.copy(callable = Callable.from(descriptor))
val actual = descriptor.createSources()
- return Function(
+ return DFunction(
dri = dri,
name = descriptor.name.asString(),
isConstructor = false,
@@ -254,10 +252,10 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- override fun visitConstructorDescriptor(descriptor: ConstructorDescriptor, parent: DRIWithPlatformInfo): Function {
+ override fun visitConstructorDescriptor(descriptor: ConstructorDescriptor, parent: DRIWithPlatformInfo): DFunction {
val dri = parent.dri.copy(callable = Callable.from(descriptor))
val actual = descriptor.createSources()
- return Function(
+ return DFunction(
dri = dri,
name = "<init>",
isConstructor = true,
@@ -281,7 +279,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
override fun visitReceiverParameterDescriptor(
descriptor: ReceiverParameterDescriptor,
parent: DRIWithPlatformInfo
- ) = Parameter(
+ ) = DParameter(
dri = parent.dri.copy(target = 0),
name = null,
type = descriptor.type.toBound(),
@@ -293,12 +291,12 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
descriptor: PropertyAccessorDescriptor,
propertyDescriptor: PropertyDescriptor,
parent: DRI
- ): Function {
+ ): DFunction {
val dri = parent.copy(callable = Callable.from(descriptor))
val isGetter = descriptor is PropertyGetterDescriptor
fun PropertyDescriptor.asParameter(parent: DRI) =
- Parameter(
+ DParameter(
parent.copy(target = 1),
this.name.asString(),
type = this.type.toBound(),
@@ -320,7 +318,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
listOf(propertyDescriptor.asParameter(dri))
}
- return Function(
+ return DFunction(
dri,
name,
isConstructor = false,
@@ -343,7 +341,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
}
private fun parameter(index: Int, descriptor: ValueParameterDescriptor, parent: DRIWithPlatformInfo) =
- Parameter(
+ DParameter(
dri = parent.dri.copy(target = index + 1),
name = descriptor.name.asString(),
type = descriptor.type.toBound(),
@@ -352,28 +350,28 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
extra = descriptor.additionalExtras()
)
- private fun MemberScope.functions(parent: DRIWithPlatformInfo): List<Function> =
+ private fun MemberScope.functions(parent: DRIWithPlatformInfo): List<DFunction> =
getContributedDescriptors(DescriptorKindFilter.FUNCTIONS) { true }
.filterIsInstance<FunctionDescriptor>()
.map { visitFunctionDescriptor(it, parent) }
- private fun MemberScope.properties(parent: DRIWithPlatformInfo): List<Property> =
+ private fun MemberScope.properties(parent: DRIWithPlatformInfo): List<DProperty> =
getContributedDescriptors(DescriptorKindFilter.VALUES) { true }
.filterIsInstance<PropertyDescriptor>()
.map { visitPropertyDescriptor(it, parent) }
- private fun MemberScope.classlikes(parent: DRIWithPlatformInfo): List<Classlike> =
+ private fun MemberScope.classlikes(parent: DRIWithPlatformInfo): List<DClasslike> =
getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS) { true }
.filterIsInstance<ClassDescriptor>()
.map { visitClassDescriptor(it, parent) }
- .mapNotNull { it as? Classlike }
+ .mapNotNull { it as? DClasslike }
- private fun MemberScope.packages(parent: DRIWithPlatformInfo): List<Package> =
+ private fun MemberScope.packages(parent: DRIWithPlatformInfo): List<DPackage> =
getContributedDescriptors(DescriptorKindFilter.PACKAGES) { true }
.filterIsInstance<PackageFragmentDescriptor>()
.map { visitPackageFragmentDescriptor(it, parent) }
- private fun MemberScope.enumEntries(parent: DRIWithPlatformInfo): List<EnumEntry> =
+ private fun MemberScope.enumEntries(parent: DRIWithPlatformInfo): List<DEnumEntry> =
this.getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS) { true }
.filterIsInstance<ClassDescriptor>()
.filter { it.kind == ClassKind.ENUM_ENTRY }
@@ -391,7 +389,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
}
private fun TypeParameterDescriptor.toTypeParameter() =
- TypeParameter(
+ DTypeParameter(
DRI.from(this),
name.identifier,
PlatformDependent.from(platformData, getDocumentation()),
@@ -428,7 +426,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
MarkdownParser(resolutionFacade, this).parseFromKDocTag(it)
}
- fun ClassDescriptor.companion(dri: DRIWithPlatformInfo): Object? = companionObjectDescriptor?.let {
+ fun ClassDescriptor.companion(dri: DRIWithPlatformInfo): DObject? = companionObjectDescriptor?.let {
objectDescriptor(it, dri)
}
@@ -467,7 +465,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
ExtraModifiers.OVERRIDE.takeIf { getSuperInterfaces().isNotEmpty() || getSuperClassNotAny() != null }
).toContainer()
- fun ValueParameterDescriptor.additionalExtras(): PropertyContainer<Parameter> =
+ fun ValueParameterDescriptor.additionalExtras(): PropertyContainer<DParameter> =
listOfNotNull(
ExtraModifiers.DYNAMIC.takeIf { isDynamic() },
ExtraModifiers.NOINLINE.takeIf { isNoinline },
@@ -477,13 +475,13 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
ExtraModifiers.VARARG.takeIf { isVararg }
).toContainer()
- fun TypeParameterDescriptor.additionalExtras(): PropertyContainer<TypeParameter> =
+ fun TypeParameterDescriptor.additionalExtras(): PropertyContainer<DTypeParameter> =
listOfNotNull(
ExtraModifiers.DYNAMIC.takeIf { isDynamic() },
ExtraModifiers.REIFIED.takeIf { isReified }
).toContainer()
- fun PropertyDescriptor.additionalExtras(): PropertyContainer<Property> = listOfNotNull(
+ fun PropertyDescriptor.additionalExtras(): PropertyContainer<DProperty> = listOfNotNull(
ExtraModifiers.DYNAMIC.takeIf { isDynamic() },
ExtraModifiers.CONST.takeIf { isConst },
ExtraModifiers.LATEINIT.takeIf { isLateInit },
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultDocumentableToPageTranslator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultDocumentableToPageTranslator.kt
index 16f9b9b3..04251947 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultDocumentableToPageTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultDocumentableToPageTranslator.kt
@@ -2,7 +2,7 @@ package org.jetbrains.dokka.base.translators.documentables
import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
-import org.jetbrains.dokka.model.Module
+import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.ModulePageNode
import org.jetbrains.dokka.transformers.documentation.DocumentableToPageTranslator
import org.jetbrains.dokka.utilities.DokkaLogger
@@ -12,6 +12,6 @@ class DefaultDocumentableToPageTranslator(
private val signatureProvider: SignatureProvider,
private val logger: DokkaLogger
) : DocumentableToPageTranslator {
- override fun invoke(module: Module): ModulePageNode =
+ override fun invoke(module: DModule): ModulePageNode =
DefaultPageCreator(commentsToContentConverter, signatureProvider, logger).pageForModule(module)
} \ No newline at end of file
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
index 560bda71..a0b5a072 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
@@ -4,7 +4,7 @@ import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.model.doc.Property
import org.jetbrains.dokka.model.doc.TagWrapper
import org.jetbrains.dokka.pages.*
@@ -17,16 +17,16 @@ open class DefaultPageCreator(
) {
protected open val contentBuilder = PageContentBuilder(commentsToContentConverter, signatureProvider, logger)
- open fun pageForModule(m: Module) =
+ open fun pageForModule(m: DModule) =
ModulePageNode(m.name.ifEmpty { "<root>" }, contentForModule(m), m, m.packages.map(::pageForPackage))
- open fun pageForPackage(p: Package): PackagePageNode = PackagePageNode(
+ open fun pageForPackage(p: DPackage): PackagePageNode = PackagePageNode(
p.name, contentForPackage(p), setOf(p.dri), p,
p.classlikes.map(::pageForClasslike) +
p.functions.map(::pageForFunction)
)
- open fun pageForClasslike(c: Classlike): ClasslikePageNode {
+ open fun pageForClasslike(c: DClasslike): ClasslikePageNode {
val constructors = if (c is WithConstructors) c.constructors else emptyList()
return ClasslikePageNode(
@@ -37,9 +37,9 @@ open class DefaultPageCreator(
)
}
- open fun pageForFunction(f: Function) = MemberPageNode(f.name, contentForFunction(f), setOf(f.dri), f)
+ open fun pageForFunction(f: DFunction) = MemberPageNode(f.name, contentForFunction(f), setOf(f.dri), f)
- protected open fun contentForModule(m: Module) = contentBuilder.contentFor(m) {
+ protected open fun contentForModule(m: DModule) = contentBuilder.contentFor(m) {
header(1) { text(m.name) }
block("Packages", 2, ContentKind.Packages, m.packages, m.platformData.toSet()) {
link(it.name, it.dri)
@@ -48,7 +48,7 @@ open class DefaultPageCreator(
// text("Link to allpage here")
}
- protected open fun contentForPackage(p: Package) = contentBuilder.contentFor(p) {
+ protected open fun contentForPackage(p: DPackage) = contentBuilder.contentFor(p) {
header(1) { text("Package ${p.name}") }
+contentForScope(p, p.dri, p.platformData)
}
@@ -87,7 +87,7 @@ open class DefaultPageCreator(
}
}
- protected open fun contentForClasslike(c: Classlike) = contentBuilder.contentFor(c) {
+ protected open fun contentForClasslike(c: DClasslike) = contentBuilder.contentFor(c) {
header(1) { text(c.name.orEmpty()) }
+buildSignature(c)
@@ -126,7 +126,7 @@ open class DefaultPageCreator(
}
}.children
- protected open fun contentForFunction(f: Function) = contentBuilder.contentFor(f) {
+ protected open fun contentForFunction(f: DFunction) = contentBuilder.contentFor(f) {
header(1) { text(f.name) }
+buildSignature(f)
+contentForComments(f)
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index 65f94843..c5c72a65 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -9,9 +9,9 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.JavaClassReference
import org.jetbrains.dokka.links.withClass
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Annotation
-import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DAnnotation
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.PlatformData
import org.jetbrains.dokka.plugability.DokkaContext
@@ -31,17 +31,17 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
psiFiles: List<PsiJavaFile>,
platformData: PlatformData,
context: DokkaContext
- ): Module {
+ ): DModule {
val docParser =
DokkaPsiParser(
platformData,
context.logger
)
- return Module(
+ return DModule(
moduleName,
psiFiles.groupBy { it.packageName }.map { (packageName, psiFiles) ->
val dri = DRI(packageName = packageName)
- Package(
+ DPackage(
dri,
emptyList(),
emptyList(),
@@ -93,7 +93,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
private fun <T> T.toPlatformDependant() =
PlatformDependent(mapOf(platformData to this))
- fun parseClasslike(psi: PsiClass, parent: DRI): Classlike = with(psi) {
+ fun parseClasslike(psi: PsiClass, parent: DRI): DClasslike = with(psi) {
val dri = parent.withClass(name.toString())
val ancestorsSet = hashSetOf<DRI>()
val superMethodsKeys = hashSetOf<Int>()
@@ -133,7 +133,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
val ancestors = ancestorsSet.toList().toPlatformDependant()
return when {
isAnnotationType ->
- Annotation(
+ DAnnotation(
name.orEmpty(),
dri,
documentation,
@@ -146,11 +146,11 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
constructors.map { parseFunction(it, dri, true) },
listOf(platformData)
)
- isEnum -> Enum(
+ isEnum -> DEnum(
dri,
name.orEmpty(),
fields.filterIsInstance<PsiEnumConstant>().map { entry ->
- EnumEntry(
+ DEnumEntry(
dri.withClass("$name.${entry.name}"),
entry.name.orEmpty(),
javadocParser.parseDocumentation(entry).toPlatformDependant(),
@@ -171,7 +171,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
ancestors,
listOf(platformData)
)
- isInterface -> Interface(
+ isInterface -> DInterface(
dri,
name.orEmpty(),
documentation,
@@ -185,7 +185,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
ancestors,
listOf(platformData)
)
- else -> Class(
+ else -> DClass(
dri,
name.orEmpty(),
constructors.map { parseFunction(it, dri, true) },
@@ -209,7 +209,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
parent: DRI,
isConstructor: Boolean = false,
isInherited: Boolean = false
- ): Function {
+ ): DFunction {
val dri = parent.copy(
callable = Callable(
psi.name,
@@ -218,12 +218,12 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
JavaClassReference(parameter.type.canonicalText)
})
)
- return Function(
+ return DFunction(
dri,
if (isConstructor) "<init>" else psi.name,
isConstructor,
psi.parameterList.parameters.mapIndexed { index, psiParameter ->
- Parameter(
+ DParameter(
dri.copy(target = index + 1),
psiParameter.name,
javadocParser.parseDocumentation(psiParameter).toPlatformDependant(),
@@ -239,7 +239,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
null,
psi.getModifier(),
listOf(platformData),
- PropertyContainer.empty<Function>() + InheritedFunction(
+ PropertyContainer.empty<DFunction>() + InheritedFunction(
isInherited
)
)
@@ -278,7 +278,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
else -> JavaModifier.Empty
}
- private fun PsiTypeParameterListOwner.mapTypeParameters(dri: DRI): List<TypeParameter> {
+ private fun PsiTypeParameterListOwner.mapTypeParameters(dri: DRI): List<DTypeParameter> {
fun mapBounds(bounds: Array<JvmReferenceType>): List<Bound> =
if (bounds.isEmpty()) emptyList() else bounds.mapNotNull {
(it as? PsiClassType)?.let { classType ->
@@ -286,7 +286,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
}
}
return typeParameters.mapIndexed { index, type ->
- TypeParameter(
+ DTypeParameter(
dri.copy(genericTarget = index),
type.name.orEmpty(),
javadocParser.parseDocumentation(type).toPlatformDependant(),
@@ -323,7 +323,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
return regularMethods to accessors
}
- private fun parseField(psi: PsiField, parent: DRI, accessors: List<PsiMethod>): Property {
+ private fun parseField(psi: PsiField, parent: DRI, accessors: List<PsiMethod>): DProperty {
val dri = parent.copy(
callable = Callable(
psi.name!!, // TODO: Investigate if this is indeed nullable
@@ -331,7 +331,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
emptyList()
)
)
- return Property(
+ return DProperty(
dri,
psi.name!!, // TODO: Investigate if this is indeed nullable
javadocParser.parseDocumentation(psi).toPlatformDependant(),