diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-03-16 14:33:38 +0100 |
---|---|---|
committer | Kamil Doległo <kamilok1965@users.noreply.github.com> | 2020-03-16 14:35:12 +0100 |
commit | 996feefe717ac623daabaadda71b5b9d2bbe1cf1 (patch) | |
tree | fca8d99c2cf4f9dcc64159b4e1ebe5644f2bd81b /plugins/base/src | |
parent | cd38992a28a8b16cd91661f05829610d1373e47c (diff) | |
download | dokka-996feefe717ac623daabaadda71b5b9d2bbe1cf1.tar.gz dokka-996feefe717ac623daabaadda71b5b9d2bbe1cf1.tar.bz2 dokka-996feefe717ac623daabaadda71b5b9d2bbe1cf1.zip |
Rename Documentables to avoid name conflicts
Diffstat (limited to 'plugins/base/src')
18 files changed, 255 insertions, 265 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(), diff --git a/plugins/base/src/test/kotlin/enums/EnumsTest.kt b/plugins/base/src/test/kotlin/enums/EnumsTest.kt index ea3238a5..34e92d82 100644 --- a/plugins/base/src/test/kotlin/enums/EnumsTest.kt +++ b/plugins/base/src/test/kotlin/enums/EnumsTest.kt @@ -1,9 +1,8 @@ package enums -import org.jetbrains.dokka.model.Enum +import org.jetbrains.dokka.model.DEnum import org.jetbrains.dokka.pages.ClasslikePageNode import org.jetbrains.dokka.pages.ModulePageNode -import org.junit.Assert import org.junit.Assert.* import org.junit.Test import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest @@ -72,7 +71,7 @@ class EnumsTest : AbstractCoreTest() { p.first().classlikes.let { c -> assertTrue("Classlikes list cannot be empty", c.isNotEmpty()) - val enum = c.first() as Enum + val enum = c.first() as DEnum assertEquals(enum.name, "Test") assertEquals(enum.entries.count(), 2) assertNotNull(enum.companion) diff --git a/plugins/base/src/test/kotlin/issues/IssuesTest.kt b/plugins/base/src/test/kotlin/issues/IssuesTest.kt index ea2f0f8e..e34c610a 100644 --- a/plugins/base/src/test/kotlin/issues/IssuesTest.kt +++ b/plugins/base/src/test/kotlin/issues/IssuesTest.kt @@ -1,7 +1,7 @@ package issues -import org.jetbrains.dokka.model.Class -import org.jetbrains.dokka.model.Function +import org.jetbrains.dokka.model.DClass +import org.jetbrains.dokka.model.DFunction import org.junit.Test import utils.AbstractModelTest @@ -33,16 +33,16 @@ class IssuesTest : AbstractModelTest("/src/main/kotlin/issues/Test.kt", "issues" |} """ ) { - with((this / "issues" / "Test").cast<Class>()) { + with((this / "issues" / "Test").cast<DClass>()) { // passes - (this / "working").cast<Function>().type.constructorFqName equals "kotlin.String" - (this / "doSomething").cast<Function>().type.constructorFqName equals "kotlin.String" + (this / "working").cast<DFunction>().type.constructorFqName equals "kotlin.String" + (this / "doSomething").cast<DFunction>().type.constructorFqName equals "kotlin.String" // fails - (this / "brokenGenerics").cast<Function>().type.constructorFqName equals "kotlin.collections.List" - (this / "brokenApply").cast<Function>().type.constructorFqName equals "issues.Test" - (this / "brokenRun").cast<Function>().type.constructorFqName equals "issues.Test" - (this / "brokenLet").cast<Function>().type.constructorFqName equals "issues.Test" + (this / "brokenGenerics").cast<DFunction>().type.constructorFqName equals "kotlin.collections.List" + (this / "brokenApply").cast<DFunction>().type.constructorFqName equals "issues.Test" + (this / "brokenRun").cast<DFunction>().type.constructorFqName equals "issues.Test" + (this / "brokenLet").cast<DFunction>().type.constructorFqName equals "issues.Test" } } } diff --git a/plugins/base/src/test/kotlin/markdown/KDocTest.kt b/plugins/base/src/test/kotlin/markdown/KDocTest.kt index e250670a..fa538c3e 100644 --- a/plugins/base/src/test/kotlin/markdown/KDocTest.kt +++ b/plugins/base/src/test/kotlin/markdown/KDocTest.kt @@ -1,6 +1,6 @@ package markdown -import org.jetbrains.dokka.model.Package +import org.jetbrains.dokka.model.DPackage import org.jetbrains.dokka.model.doc.DocumentationNode import org.jetbrains.dokka.pages.ModulePageNode import org.junit.Assert @@ -26,7 +26,7 @@ open class KDocTest : AbstractCoreTest() { """.trimMargin() private fun actualDocumentationNode(modulePageNode: ModulePageNode) = - (modulePageNode.documentable?.children?.first() as Package) + (modulePageNode.documentable?.children?.first() as DPackage) .classlikes.single() .documentation.values.single() diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt index a59174bf..d627dab4 100644 --- a/plugins/base/src/test/kotlin/model/ClassesTest.kt +++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt @@ -2,7 +2,7 @@ package model import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.KotlinModifier.* -import org.jetbrains.dokka.model.Function +import org.jetbrains.dokka.model.DFunction import org.junit.Test import utils.AbstractModelTest import utils.assertNotNull @@ -17,7 +17,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class """ |class Klass {}""" ) { - with((this / "classes" / "Klass").cast<Class>()) { + with((this / "classes" / "Klass").cast<DClass>()) { name equals "Klass" children counts 4 } @@ -31,7 +31,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |object Obj {} """ ) { - with((this / "classes" / "Obj").cast<Object>()) { + with((this / "classes" / "Obj").cast<DObject>()) { name equals "Obj" children counts 3 } @@ -45,7 +45,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |class Klass(name: String) """ ) { - with((this / "classes" / "Klass").cast<Class>()) { + with((this / "classes" / "Klass").cast<DClass>()) { name equals "Klass" children counts 4 @@ -71,11 +71,11 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |} """ ) { - with((this / "classes" / "Klass").cast<Class>()) { + with((this / "classes" / "Klass").cast<DClass>()) { name equals "Klass" children counts 5 - with((this / "fn").cast<Function>()) { + with((this / "fn").cast<DFunction>()) { type.constructorFqName equals "kotlin.Unit" parameters counts 0 visibility.values allEquals KotlinVisibility.Public @@ -93,11 +93,11 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |} """ ) { - with((this / "classes" / "Klass").cast<Class>()) { + with((this / "classes" / "Klass").cast<DClass>()) { name equals "Klass" children counts 5 - with((this / "name").cast<Property>()) { + with((this / "name").cast<DProperty>()) { name equals "name" // TODO property name } @@ -117,19 +117,19 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |} """ ) { - with((this / "classes" / "Klass").cast<Class>()) { + with((this / "classes" / "Klass").cast<DClass>()) { name equals "Klass" children counts 5 - with((this / "Companion").cast<Object>()) { + with((this / "Companion").cast<DObject>()) { name equals "Companion" children counts 5 - with((this / "x").cast<Property>()) { + with((this / "x").cast<DProperty>()) { name equals "x" } - with((this / "foo").cast<Function>()) { + with((this / "foo").cast<DFunction>()) { name equals "foo" parameters counts 0 type.constructorFqName equals "kotlin.Unit" @@ -146,7 +146,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |data class Klass() {} """ ) { - with((this / "classes" / "Klass").cast<Class>()) { + with((this / "classes" / "Klass").cast<DClass>()) { name equals "Klass" visibility.values allEquals KotlinVisibility.Public with(extra[AdditionalModifiers.AdditionalKey].assertNotNull("Extras")) { @@ -170,7 +170,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |sealed class Klass() {} """ ) { - with((this / "classes" / "Klass").cast<Class>()) { + with((this / "classes" / "Klass").cast<DClass>()) { name equals "Klass" modifier equals KotlinModifier.Sealed } @@ -215,18 +215,18 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |} """ ) { - val C = (this / "classes" / "C").cast<Class>() - val D = (this / "classes" / "D").cast<Class>() + val C = (this / "classes" / "C").cast<DClass>() + val D = (this / "classes" / "D").cast<DClass>() with(C) { modifier equals Open - with((this / "f").cast<Function>()) { + with((this / "f").cast<DFunction>()) { modifier equals Open } } with(D) { modifier equals Final - with((this / "f").cast<Function>()) { + with((this / "f").cast<DFunction>()) { modifier equals Open } D.supertypes.flatMap { it.component2() }.firstOrNull() equals C.dri @@ -249,13 +249,13 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |} """ ) { - val C = (this / "classes" / "C").cast<Class>() - val D = (this / "classes" / "D").cast<Class>() - val E = (this / "classes" / "E").cast<Class>() + val C = (this / "classes" / "C").cast<DClass>() + val D = (this / "classes" / "D").cast<DClass>() + val E = (this / "classes" / "E").cast<DClass>() with(C) { modifier equals Abstract - ((this / "foo").cast<Function>()).modifier equals Abstract + ((this / "foo").cast<DFunction>()).modifier equals Abstract } with(D) { @@ -280,9 +280,9 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |} """ ) { - with((this / "classes" / "C").cast<Class>()) { + with((this / "classes" / "C").cast<DClass>()) { - with((this / "D").cast<Class>()) { + with((this / "D").cast<DClass>()) { } } } @@ -312,10 +312,10 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |val Klass.Default.x: Int get() = 1 """ ) { - with((this / "classes" / "Klass").cast<Class>()) { + with((this / "classes" / "Klass").cast<DClass>()) { name equals "Klass" - with((this / "Default").cast<Object>()) { + with((this / "Default").cast<DObject>()) { name equals "Default" // TODO extensions } @@ -342,7 +342,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |} """ ) { - with((this / "classes" / "C").cast<Class>()) { + with((this / "classes" / "C").cast<DClass>()) { name equals "C" constructors counts 2 @@ -384,14 +384,14 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class |} """ ) { - with((this / "classes" / "Klass").cast<Class>()) { + with((this / "classes" / "Klass").cast<DClass>()) { name equals "Klass" - with((this / "Companion").cast<Object>()) { + with((this / "Companion").cast<DObject>()) { name equals "Companion" visibility.values allEquals KotlinVisibility.Private - with((this / "fn").cast<Function>()) { + with((this / "fn").cast<DFunction>()) { name equals "fn" parameters counts 0 receiver equals null diff --git a/plugins/base/src/test/kotlin/model/CommentTest.kt b/plugins/base/src/test/kotlin/model/CommentTest.kt index d576cf49..055892af 100644 --- a/plugins/base/src/test/kotlin/model/CommentTest.kt +++ b/plugins/base/src/test/kotlin/model/CommentTest.kt @@ -1,6 +1,6 @@ package model -import org.jetbrains.dokka.model.Property +import org.jetbrains.dokka.model.DProperty import org.jetbrains.dokka.model.doc.CustomWrapperTag import org.jetbrains.dokka.model.doc.Text import org.junit.Test @@ -28,7 +28,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |val prop2 = "" """ ) { - with((this / "comment" / "prop1").cast<Property>()) { + with((this / "comment" / "prop1").cast<DProperty>()) { name equals "prop1" with(this.docs().firstOrNull()?.root.assertNotNull("Code")) { (children.firstOrNull() as? Text) @@ -37,7 +37,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme params["lang"] equals "brainfuck" } } - with((this / "comment" / "prop2").cast<Property>()) { + with((this / "comment" / "prop2").cast<DProperty>()) { name equals "prop2" comments() equals "a + b - c" } @@ -51,7 +51,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme val property = "test" """ ) { - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { name equals "property" comments() equals "" } @@ -68,7 +68,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme """ ) { val p = this - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { comments() equals "" } } @@ -87,7 +87,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |val property = "test" """ ) { - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { comments() equals "doc1\ndoc2 doc3" } } @@ -107,7 +107,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |val property = "test" """ ) { - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { comments() equals "doc1\ndoc2 doc3" } } @@ -121,7 +121,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |val property = "test" """ ) { - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { comments() equals "doc" } } @@ -136,7 +136,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |val property = "test" """ ) { - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { comments() equals "doc" } } @@ -151,7 +151,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |val property = "test" """ ) { - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { comments() equals "doc" } } @@ -168,7 +168,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |val property = "test" """ ) { - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { comments() equals "Summary\none: []" docs().find { it is CustomWrapperTag && it.name == "one" }.let { with(it.assertNotNull("'one' entry")) { @@ -188,7 +188,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |val property = "test" """ ) { - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { comments() equals """it's "useful"""" } } @@ -205,7 +205,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |val property = "test" """ ) { - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { comments() equals "Summary\none: [section one]" } } @@ -224,7 +224,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |val property = "test" """ ) { - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { comments() equals "Summary\none: [section one]\ntwo: [section two]" } } @@ -243,7 +243,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |val property = "test" """ ) { - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { comments() equals "Summary\none: [line one line two]" } } @@ -290,7 +290,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |} """ ) { - with((this / "comment" / "property").cast<Property>()) { + with((this / "comment" / "property").cast<DProperty>()) { this } } diff --git a/plugins/base/src/test/kotlin/model/FunctionsTest.kt b/plugins/base/src/test/kotlin/model/FunctionsTest.kt index 9554ad02..f3a7adc7 100644 --- a/plugins/base/src/test/kotlin/model/FunctionsTest.kt +++ b/plugins/base/src/test/kotlin/model/FunctionsTest.kt @@ -1,7 +1,7 @@ package model -import org.jetbrains.dokka.model.Function -import org.jetbrains.dokka.model.Package +import org.jetbrains.dokka.model.DFunction +import org.jetbrains.dokka.model.DPackage import org.junit.Test import utils.* @@ -17,7 +17,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun |fun fn() {} """ ) { - with((this / "function" / "fn").cast<Function>()) { + with((this / "function" / "fn").cast<DFunction>()) { name equals "fn" type.constructorFqName equals "kotlin.Unit" this.children.assertCount(0, "Function children: ") @@ -39,7 +39,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun |fun fn(i: Int) {} """ ) { - with((this / "function").cast<Package>()) { + with((this / "function").cast<DPackage>()) { val fn1 = functions.find { it.name == "fn" && it.parameters.isNullOrEmpty() }.assertNotNull("fn()") @@ -76,7 +76,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun |fun String.fn(x: Int) {} """ ) { - with((this / "function").cast<Package>()) { + with((this / "function").cast<DPackage>()) { val fn1 = functions.find { it.name == "fn" && it.parameters.isNullOrEmpty() }.assertNotNull("fn()") @@ -114,7 +114,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun |} """ ) { - with((this / "function" / "function").cast<Function>()) { + with((this / "function" / "function").cast<DFunction>()) { comments() equals "Multiline\nFunction Documentation" name equals "function" @@ -141,7 +141,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun ) { // TODO add annotations - with((this / "function" / "f").cast<Function>()) { + with((this / "function" / "f").cast<DFunction>()) { assert(false) { "No annotation data" } } } @@ -162,7 +162,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun ) { // TODO add data about inline - with((this / "function" / "f").cast<Function>()) { + with((this / "function" / "f").cast<DFunction>()) { assert(false) { "No inline data" } } } @@ -184,7 +184,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun ) { // TODO add data about suspend - with((this / "function" / "f").cast<Function>()) { + with((this / "function" / "f").cast<DFunction>()) { assert(false) { "No suspend data" } } } diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt index ea454763..c2545e7a 100644 --- a/plugins/base/src/test/kotlin/model/JavaTest.kt +++ b/plugins/base/src/test/kotlin/model/JavaTest.kt @@ -1,8 +1,8 @@ package model 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.junit.Assert.assertTrue import org.junit.Test import utils.AbstractModelTest @@ -24,10 +24,10 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { |} """ ) { - with((this / "java" / "Test").cast<Class>()) { + with((this / "java" / "Test").cast<DClass>()) { name equals "Test" children counts 1 - with((this / "fn").cast<Function>()) { + with((this / "fn").cast<DFunction>()) { name equals "fn" this } @@ -82,7 +82,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { |} """ ) { - with((this / "java" / "Test" / "fn").cast<Function>()) { + with((this / "java" / "Test" / "fn").cast<DFunction>()) { this } } @@ -108,7 +108,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { |public class Foo extends Exception implements Cloneable {} """ ) { - with((this / "java" / "Foo").cast<Class>()) { + with((this / "java" / "Foo").cast<DClass>()) { val sups = listOf("Exception", "Cloneable") assertTrue( "Foo must extend ${sups.joinToString(", ")}", @@ -128,11 +128,11 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { |} """ ) { - with((this / "java" / "Test").cast<Class>()) { + with((this / "java" / "Test").cast<DClass>()) { name equals "Test" children counts 1 - with((this / "arrayToString").cast<Function>()) { + with((this / "arrayToString").cast<DFunction>()) { name equals "arrayToString" type.constructorFqName equals "java.lang.String[]" with(parameters.firstOrNull().assertNotNull("parameters")) { @@ -153,7 +153,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { |} """ ) { - with((this / "java" / "Foo").cast<Class>()) { + with((this / "java" / "Foo").cast<DClass>()) { this } } @@ -189,7 +189,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { |} """ ) { - with((this / "java" / "Test").cast<Class>()) { + with((this / "java" / "Test").cast<DClass>()) { name equals "Test" constructors counts 2 @@ -211,9 +211,9 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { |} """ ) { - with((this / "java" / "InnerClass").cast<Class>()) { + with((this / "java" / "InnerClass").cast<DClass>()) { children counts 1 - with((this / "D").cast<Class>()) { + with((this / "D").cast<DClass>()) { name equals "D" children counts 0 } @@ -230,11 +230,11 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { |} """ ) { - with((this / "java" / "Foo").cast<Class>()) { + with((this / "java" / "Foo").cast<DClass>()) { name equals "Foo" children counts 1 - with((this / "bar").cast<Function>()) { + with((this / "bar").cast<DFunction>()) { name equals "bar" with(parameters.firstOrNull().assertNotNull("parameter")) { name equals "x" @@ -255,15 +255,15 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { |} """ ) { - with((this / "java" / "Test").cast<Class>()) { + with((this / "java" / "Test").cast<DClass>()) { children counts 2 - with((this / "i").cast<Property>()) { + with((this / "i").cast<DProperty>()) { getter.assertNotNull("i.get") setter.assertNotNull("i.set") } - with((this / "s").cast<Property>()) { + with((this / "s").cast<DProperty>()) { getter.assertNotNull("s.get") setter.assertNotNull("s.set") @@ -344,11 +344,11 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { |} """ ) { - with((this / "java" / "E").cast<Enum>()) { + with((this / "java" / "E").cast<DEnum>()) { name equals "E" entries counts 1 - with((this / "Foo").cast<EnumEntry>()) { + with((this / "Foo").cast<DEnumEntry>()) { name equals "Foo" } } diff --git a/plugins/base/src/test/kotlin/model/PackagesTest.kt b/plugins/base/src/test/kotlin/model/PackagesTest.kt index e19cc82d..008ae14d 100644 --- a/plugins/base/src/test/kotlin/model/PackagesTest.kt +++ b/plugins/base/src/test/kotlin/model/PackagesTest.kt @@ -1,6 +1,6 @@ package model -import org.jetbrains.dokka.model.Package +import org.jetbrains.dokka.model.DPackage import org.junit.Test import utils.AbstractModelTest @@ -14,7 +14,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac """.trimIndent(), prependPackage = false ) { - with((this / "").cast<Package>()) { + with((this / "").cast<DPackage>()) { name equals "" children counts 0 } @@ -29,7 +29,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac """.trimIndent(), prependPackage = false ) { - with((this / "simple").cast<Package>()) { + with((this / "simple").cast<DPackage>()) { name equals "simple" children counts 0 } @@ -44,7 +44,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac """.trimIndent(), prependPackage = false ) { - with((this / "dot.name").cast<Package>()) { + with((this / "dot.name").cast<DPackage>()) { name equals "dot.name" children counts 0 } @@ -63,11 +63,11 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac prependPackage = false ) { children counts 2 - with((this / "dot.name").cast<Package>()) { + with((this / "dot.name").cast<DPackage>()) { name equals "dot.name" children counts 0 } - with((this / "simple").cast<Package>()) { + with((this / "simple").cast<DPackage>()) { name equals "simple" children counts 0 } @@ -85,7 +85,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac prependPackage = false ) { children counts 1 - with((this / "simple").cast<Package>()) { + with((this / "simple").cast<DPackage>()) { name equals "simple" children counts 0 } @@ -102,7 +102,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac """.trimIndent(), prependPackage = false ) { - with((this / "simple.name").cast<Package>()) { + with((this / "simple.name").cast<DPackage>()) { name equals "simple.name" children counts 1 } diff --git a/plugins/base/src/test/kotlin/model/PropertyTest.kt b/plugins/base/src/test/kotlin/model/PropertyTest.kt index e4ef0aec..d12e292b 100644 --- a/plugins/base/src/test/kotlin/model/PropertyTest.kt +++ b/plugins/base/src/test/kotlin/model/PropertyTest.kt @@ -1,8 +1,8 @@ package model import org.jetbrains.dokka.model.KotlinVisibility -import org.jetbrains.dokka.model.Package -import org.jetbrains.dokka.model.Property +import org.jetbrains.dokka.model.DPackage +import org.jetbrains.dokka.model.DProperty import org.junit.Test import utils.AbstractModelTest import utils.assertNotNull @@ -15,7 +15,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro """ |val property = "test"""" ) { - with((this / "property" / "property").cast<Property>()) { + with((this / "property" / "property").cast<DProperty>()) { name equals "property" children counts 0 with(getter.assertNotNull("Getter")) { @@ -33,7 +33,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro |var property = "test" """ ) { - with((this / "property" / "property").cast<Property>()) { + with((this / "property" / "property").cast<DProperty>()) { name equals "property" children counts 0 setter.assertNotNull("Setter") @@ -53,7 +53,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro | get() = "test" """ ) { - with((this / "property" / "property").cast<Property>()) { + with((this / "property" / "property").cast<DProperty>()) { name equals "property" children counts 0 with(getter.assertNotNull("Getter")) { @@ -73,7 +73,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro | set(value) {} """ ) { - with((this / "property" / "property").cast<Property>()) { + with((this / "property" / "property").cast<DProperty>()) { name equals "property" children counts 0 setter.assertNotNull("Setter") @@ -93,7 +93,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro | get() = size() * 2 """ ) { - with((this / "property" / "property").cast<Property>()) { + with((this / "property" / "property").cast<DProperty>()) { name equals "property" children counts 0 with(receiver.assertNotNull("property receiver")) { @@ -120,15 +120,15 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro |} """ ) { - with((this / "property").cast<Package>()) { - with((this / "Foo" / "property").cast<Property>()) { + with((this / "property").cast<DPackage>()) { + with((this / "Foo" / "property").cast<DProperty>()) { name equals "property" children counts 0 with(getter.assertNotNull("Getter")) { type.constructorFqName equals "kotlin.Int" } } - with((this / "Bar" / "property").cast<Property>()) { + with((this / "Bar" / "property").cast<DProperty>()) { name equals "property" children counts 0 with(getter.assertNotNull("Getter")) { diff --git a/plugins/base/src/test/kotlin/utils/ModelUtils.kt b/plugins/base/src/test/kotlin/utils/ModelUtils.kt index 75c8e008..1e6f64c6 100644 --- a/plugins/base/src/test/kotlin/utils/ModelUtils.kt +++ b/plugins/base/src/test/kotlin/utils/ModelUtils.kt @@ -1,8 +1,6 @@ package utils -import org.jetbrains.dokka.model.Module -import org.jetbrains.dokka.model.doc.DocumentationNode -import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest +import org.jetbrains.dokka.model.DModule abstract class AbstractModelTest(val path: String? = null, val pkg: String) : ModelDSL(), AssertDSL { @@ -11,7 +9,7 @@ abstract class AbstractModelTest(val path: String? = null, val pkg: String) : Mo platform: String = "jvm", targetList: List<String> = listOf("jvm"), prependPackage: Boolean = true, - block: Module.() -> Unit + block: DModule.() -> Unit ) { val configuration = dokkaConfiguration { passes { diff --git a/plugins/base/src/test/kotlin/utils/TestUtils.kt b/plugins/base/src/test/kotlin/utils/TestUtils.kt index 6913ba5b..bf86c1b1 100644 --- a/plugins/base/src/test/kotlin/utils/TestUtils.kt +++ b/plugins/base/src/test/kotlin/utils/TestUtils.kt @@ -1,13 +1,9 @@ package utils -import org.jetbrains.dokka.model.Class +import org.jetbrains.dokka.model.DClass import org.jetbrains.dokka.model.Documentable -import org.jetbrains.dokka.model.Function -import org.jetbrains.dokka.model.Property import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest -import kotlin.reflect.KClass -import kotlin.reflect.full.safeCast @DslMarker annotation class TestDSL @@ -64,5 +60,5 @@ fun <T> T?.assertNotNull(name: String = ""): T = this ?: throw AssertionError("$ fun <T : Documentable> T?.docs() = this?.documentation.orEmpty().values.flatMap { it.children } -val Class.supers +val DClass.supers get() = supertypes.flatMap{it.component2()}
\ No newline at end of file |