diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2022-04-29 15:03:08 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-29 15:03:08 +0300 |
commit | 8c218ff4dd5f970233c43845c19299fc74256389 (patch) | |
tree | b6818183ce8faa2c58d6571ca1c86aa28d4f0431 /plugins/base | |
parent | 84aacad29982240ae367b21e9d283d38dab672ae (diff) | |
download | dokka-8c218ff4dd5f970233c43845c19299fc74256389.tar.gz dokka-8c218ff4dd5f970233c43845c19299fc74256389.tar.bz2 dokka-8c218ff4dd5f970233c43845c19299fc74256389.zip |
Enable warnings as errors and fix all warnings (#2451)
* Enable warnings as errors and fix all warnings
* Enable skip-metadata-version-check compiler setting
Diffstat (limited to 'plugins/base')
34 files changed, 248 insertions, 285 deletions
diff --git a/plugins/base/base-test-utils/src/main/kotlin/utils/assertHtmlEqualsIgnoringWhitespace.kt b/plugins/base/base-test-utils/src/main/kotlin/utils/assertHtmlEqualsIgnoringWhitespace.kt index 95dcae4e..eeeea265 100644 --- a/plugins/base/base-test-utils/src/main/kotlin/utils/assertHtmlEqualsIgnoringWhitespace.kt +++ b/plugins/base/base-test-utils/src/main/kotlin/utils/assertHtmlEqualsIgnoringWhitespace.kt @@ -1,8 +1,8 @@ package utils -import junit.framework.Assert.assertEquals import org.jsoup.Jsoup import org.jsoup.nodes.Document +import kotlin.test.assertEquals /** * Parses it using JSOUP, trims whitespace at the end of the line and asserts if they are equal diff --git a/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt b/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt index 75617e0c..d3006f33 100644 --- a/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt +++ b/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt @@ -74,7 +74,7 @@ open class MarkdownParser( ).flatMap { it.children } ) - private fun horizontalRulesHandler(node: ASTNode) = + private fun horizontalRulesHandler() = DocTagsFromIElementFactory.getInstance(MarkdownTokenTypes.HORIZONTAL_RULE) private fun emphasisHandler(node: ASTNode) = @@ -353,7 +353,7 @@ open class MarkdownParser( MarkdownElementTypes.ATX_5, MarkdownElementTypes.ATX_6, -> headersHandler(node) - MarkdownTokenTypes.HORIZONTAL_RULE -> horizontalRulesHandler(node) + MarkdownTokenTypes.HORIZONTAL_RULE -> horizontalRulesHandler() MarkdownElementTypes.STRONG -> strongHandler(node) MarkdownElementTypes.EMPH -> emphasisHandler(node) MarkdownElementTypes.FULL_REFERENCE_LINK, diff --git a/plugins/base/src/main/kotlin/parsers/factories/DocTagsFromIElementFactory.kt b/plugins/base/src/main/kotlin/parsers/factories/DocTagsFromIElementFactory.kt index a3cbcc2e..ea87dce8 100644 --- a/plugins/base/src/main/kotlin/parsers/factories/DocTagsFromIElementFactory.kt +++ b/plugins/base/src/main/kotlin/parsers/factories/DocTagsFromIElementFactory.kt @@ -54,6 +54,7 @@ object DocTagsFromIElementFactory { MarkdownTokenTypes.HTML_BLOCK_CONTENT -> Text(body.orEmpty(), params = params + contentTypeParam("html")) else -> CustomDocTag(children, params, type.name) }.let { + @Suppress("UNCHECKED_CAST") when (it) { is List<*> -> it as List<DocTag> else -> listOf(it as DocTag) diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 05559469..7ce41866 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -367,8 +367,6 @@ open class HtmlRenderer( pageContext: ContentPage ) = // TODO: extension point there if (node.isImage()) { - //TODO: add imgAttrs parsing - val imgAttrs = node.extra.allOfType<SimpleAttr>().joinAttr() img(src = node.address, alt = node.altText) } else { println("Unrecognized resource type: $node") @@ -377,17 +375,16 @@ open class HtmlRenderer( private fun FlowContent.buildRow( node: ContentGroup, pageContext: ContentPage, - sourceSetRestriction: Set<DisplaySourceSet>?, - style: Set<Style> + sourceSetRestriction: Set<DisplaySourceSet>? ) { node.children .filter { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } } .takeIf { it.isNotEmpty() } ?.let { when (pageContext) { - is MultimoduleRootPage -> buildRowForMultiModule(node, it, pageContext, sourceSetRestriction, style) - is ModulePage -> buildRowForModule(node, it, pageContext, sourceSetRestriction, style) - else -> buildRowForContent(node, it, pageContext, sourceSetRestriction, style) + is MultimoduleRootPage -> buildRowForMultiModule(node, it, pageContext, sourceSetRestriction) + is ModulePage -> buildRowForModule(node, it, pageContext, sourceSetRestriction) + else -> buildRowForContent(node, it, pageContext, sourceSetRestriction) } } } @@ -396,8 +393,7 @@ open class HtmlRenderer( contextNode: ContentGroup, toRender: List<ContentNode>, pageContext: ContentPage, - sourceSetRestriction: Set<DisplaySourceSet>?, - style: Set<Style> + sourceSetRestriction: Set<DisplaySourceSet>? ) { buildAnchor(contextNode) div(classes = "table-row") { @@ -414,8 +410,7 @@ open class HtmlRenderer( contextNode: ContentGroup, toRender: List<ContentNode>, pageContext: ContentPage, - sourceSetRestriction: Set<DisplaySourceSet>?, - style: Set<Style> + sourceSetRestriction: Set<DisplaySourceSet>? ) { buildAnchor(contextNode) div(classes = "table-row") { @@ -440,8 +435,7 @@ open class HtmlRenderer( contextNode: ContentGroup, toRender: List<ContentNode>, pageContext: ContentPage, - sourceSetRestriction: Set<DisplaySourceSet>?, - style: Set<Style> + sourceSetRestriction: Set<DisplaySourceSet>? ) { buildAnchor(contextNode) div(classes = "table-row") { @@ -551,7 +545,7 @@ open class HtmlRenderer( else -> div(classes = "table") { node.extra.extraHtmlAttributes().forEach { attributes[it.extraKey] = it.extraValue } node.children.forEach { - buildRow(it, pageContext, sourceSetRestriction, node.style) + buildRow(it, pageContext, sourceSetRestriction) } } } diff --git a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt index b6841323..dc5a9543 100644 --- a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt +++ b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt @@ -163,16 +163,23 @@ interface JvmSignatureUtils { } } - fun <T : Documentable> WithExtraProperties<T>.stylesIfDeprecated(sourceSetData: DokkaSourceSet): Set<TextStyle> = - if (extra[Annotations]?.directAnnotations?.get(sourceSetData)?.any { - it.dri == DRI("kotlin", "Deprecated") - || it.dri == DRI("java.lang", "Deprecated") - } == true) setOf(TextStyle.Strikethrough) else emptySet() - - infix fun DFunction.uses(t: DTypeParameter): Boolean { - val allDris: List<DRI> = (listOfNotNull(receiver?.dri, *receiver?.type?.drisOfAllNestedBounds?.toTypedArray() ?: emptyArray()) + - parameters.flatMap { listOf(it.dri) + it.type.drisOfAllNestedBounds }) - return t.dri in allDris + fun <T : Documentable> WithExtraProperties<T>.stylesIfDeprecated(sourceSetData: DokkaSourceSet): Set<TextStyle> { + val directAnnotations = extra[Annotations]?.directAnnotations?.get(sourceSetData) ?: emptyList() + val hasAnyDeprecatedAnnotation = + directAnnotations.any { it.dri == DRI("kotlin", "Deprecated") || it.dri == DRI("java.lang", "Deprecated") } + + return if (hasAnyDeprecatedAnnotation) setOf(TextStyle.Strikethrough) else emptySet() + } + + infix fun DFunction.uses(typeParameter: DTypeParameter): Boolean { + val parameterDris = parameters.flatMap { listOf(it.dri) + it.type.drisOfAllNestedBounds } + val receiverDris = + listOfNotNull( + receiver?.dri, + *receiver?.type?.drisOfAllNestedBounds?.toTypedArray() ?: emptyArray() + ) + val allDris = parameterDris + receiverDris + return typeParameter.dri in allDris } /** diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index ba4b4131..642c01c3 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -13,10 +13,7 @@ import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.Nullable import org.jetbrains.dokka.model.TypeConstructor import org.jetbrains.dokka.model.properties.WithExtraProperties -import org.jetbrains.dokka.pages.ContentKind -import org.jetbrains.dokka.pages.ContentNode -import org.jetbrains.dokka.pages.TextStyle -import org.jetbrains.dokka.pages.TokenStyle +import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.plugin import org.jetbrains.dokka.plugability.querySingle @@ -96,12 +93,16 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog } } - private fun actualTypealiasedSignature(c: DClasslike, sourceSet: DokkaSourceSet, aliasedType: Bound) = - contentBuilder.contentFor( + private fun actualTypealiasedSignature(c: DClasslike, sourceSet: DokkaSourceSet, aliasedType: Bound): ContentGroup { + @Suppress("UNCHECKED_CAST") + val deprecationStyles = (c as? WithExtraProperties<out Documentable>) + ?.stylesIfDeprecated(sourceSet) + ?: emptySet() + + return contentBuilder.contentFor( c, ContentKind.Symbol, - setOf(TextStyle.Monospace) + ((c as? WithExtraProperties<out Documentable>)?.stylesIfDeprecated(sourceSet) - ?: emptySet()), + setOf(TextStyle.Monospace) + deprecationStyles, sourceSets = setOf(sourceSet) ) { keyword("actual ") @@ -110,15 +111,24 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog operator(" = ") signatureForProjection(aliasedType) } + } - @Suppress("UNCHECKED_CAST") - private fun <T : DClasslike> classlikeSignature(c: T): List<ContentNode> = - c.sourceSets.map { sourceSetData -> - (c as? WithExtraProperties<out DClasslike>)?.extra?.get(ActualTypealias)?.underlyingType?.get(sourceSetData) - ?.let { - actualTypealiasedSignature(c, sourceSetData, it) - } ?: regularSignature(c, sourceSetData) + private fun <T : DClasslike> classlikeSignature(c: T): List<ContentNode> { + @Suppress("UNCHECKED_CAST") + val typeAliasUnderlyingType = (c as? WithExtraProperties<out DClasslike>) + ?.extra + ?.get(ActualTypealias) + ?.underlyingType + + return c.sourceSets.map { sourceSetData -> + val sourceSetType = typeAliasUnderlyingType?.get(sourceSetData) + if (sourceSetType == null) { + regularSignature(c, sourceSetData) + } else { + actualTypealiasedSignature(c, sourceSetData, sourceSetType) + } } + } private fun <T : Documentable> PageContentBuilder.DocumentableContentBuilder.defaultValueAssign( d: WithExtraProperties<T>, @@ -134,27 +144,33 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog } } - private fun regularSignature(c: DClasslike, sourceSet: DokkaSourceSet) = - contentBuilder.contentFor( + private fun regularSignature(c: DClasslike, sourceSet: DokkaSourceSet): ContentGroup { + @Suppress("UNCHECKED_CAST") + val deprecationStyles = (c as? WithExtraProperties<out Documentable>) + ?.stylesIfDeprecated(sourceSet) + ?: emptySet() + + return contentBuilder.contentFor( c, ContentKind.Symbol, - setOf(TextStyle.Monospace) + ((c as? WithExtraProperties<out Documentable>)?.stylesIfDeprecated(sourceSet) - ?: emptySet()), + setOf(TextStyle.Monospace) + deprecationStyles, sourceSets = setOf(sourceSet) ) { annotationsBlock(c) c.visibility[sourceSet]?.takeIf { it !in ignoredVisibilities }?.name?.let { keyword("$it ") } if (c.isExpectActual) keyword(if (sourceSet == c.expectPresentInSet) "expect " else "actual ") if (c is DClass) { - val modifier = if (c.modifier[sourceSet] !in ignoredModifiers) + val modifier = + if (c.modifier[sourceSet] !in ignoredModifiers) { when { c.extra[AdditionalModifiers]?.content?.get(sourceSet)?.contains(ExtraModifiers.KotlinOnlyModifiers.Data) == true -> "" c.modifier[sourceSet] is JavaModifier.Empty -> "${KotlinModifier.Open.name} " - else -> c.modifier[sourceSet]?.name?.let { "$it " } ?: "" + else -> c.modifier[sourceSet]?.name?.let { "$it " } } - else - "" - modifier.takeIf { it.isNotEmpty() }?.let { keyword(it) } + } else { + null + } + modifier?.takeIf { it.isNotEmpty() }?.let { keyword(it) } } when (c) { is DClass -> { @@ -232,6 +248,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog } } } + } /** * An example would be a primary constructor `class A(val s: String)`, diff --git a/plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt b/plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt index 71245778..98cabd72 100644 --- a/plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt +++ b/plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt @@ -49,6 +49,7 @@ private object FileSerializer : StdScalarSerializer<File>(File::class.java) { } } +@Suppress("DEPRECATION") // for TypeFactory constructor, no way to use non-deprecated one, it's essentially identical private class PluginTypeFactory: TypeFactory(null) { override fun findClass(className: String): Class<out Any>? = Class.forName(className, true, DokkaBase::class.java.classLoader) ?: super.findClass(className) diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ActualTypealiasAdder.kt b/plugins/base/src/main/kotlin/transformers/documentables/ActualTypealiasAdder.kt index a9b99840..58c601bc 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/ActualTypealiasAdder.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/ActualTypealiasAdder.kt @@ -66,7 +66,7 @@ class ActualTypealiasAdder : DocumentableTransformer { elements.map { element -> if (element.expectPresentInSet != null) { typealiases[element.dri]?.let { ta -> - element.withNewExtras(element.extra + ActualTypealias(ta.underlyingType)).let { + val merged = element.withNewExtras(element.extra + ActualTypealias(ta.underlyingType)).let { when(it) { is DClass -> it.copy(sourceSets = element.sourceSets + ta.sourceSets) is DEnum -> it.copy(sourceSets = element.sourceSets + ta.sourceSets) @@ -75,7 +75,9 @@ class ActualTypealiasAdder : DocumentableTransformer { is DAnnotation -> it.copy(sourceSets = element.sourceSets + ta.sourceSets) else -> throw IllegalStateException("${it::class.qualifiedName} ${it.name} cannot have copy its sourceSets") } - } as T + } + @Suppress("UNCHECKED_CAST") + merged as T } ?: element } else { element diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt index 6239ad6b..17e3cbcd 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt @@ -49,7 +49,7 @@ internal class DefaultDocumentableMerger(val context: DokkaContext) : Documentab fun mergeClashingElements(elements: List<Pair<T, Set<DokkaConfiguration.DokkaSourceSet>>>): List<T> = elements.groupBy { it.first.name }.values.flatMap { listOfDocumentableToSSIds -> - listOfDocumentableToSSIds.map { (documentable, sourceSets) -> + val merged = listOfDocumentableToSSIds.map { (documentable, sourceSets) -> when (documentable) { is DClass -> documentable.copy( extra = documentable.extra + ClashingDriIdentifier( @@ -88,7 +88,9 @@ internal class DefaultDocumentableMerger(val context: DokkaContext) : Documentab ) else -> documentable } - } as List<T> + } + @Suppress("UNCHECKED_CAST") + merged as List<T> } diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt index 4ca3d861..94688799 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt @@ -35,10 +35,12 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe packageOptions.firstOrNull { Regex(it.matchingRegex).matches(name) } } - val (documentedVisibilities, includeNonPublic) = when { - packageOpts != null -> packageOpts.documentedVisibilities to packageOpts.includeNonPublic - else -> globalOptions.documentedVisibilities to globalOptions.includeNonPublic - } + val (documentedVisibilities, includeNonPublic) = + @Suppress("DEPRECATION") // for includeNonPublic, preserve backwards compatibility + when { + packageOpts != null -> packageOpts.documentedVisibilities to packageOpts.includeNonPublic + else -> globalOptions.documentedVisibilities to globalOptions.includeNonPublic + } // if `documentedVisibilities` is explicitly overridden by the user (i.e. not default value by reference), // deprecated `includeNonPublic` should not be taken into account, so that only one setting prevails @@ -176,7 +178,7 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe ): Pair<Boolean, List<DProperty>> { val modifier: (DProperty, Set<DokkaSourceSet>) -> Pair<Boolean, DProperty> = - { original, filteredPlatforms -> + { original, _ -> val setter = original.setter?.let { filterFunctions(listOf(it), additionalConditionAccessors) } val getter = original.getter?.let { filterFunctions(listOf(it), additionalConditionAccessors) } diff --git a/plugins/base/src/main/kotlin/transformers/documentables/InheritedEntriesDocumentableFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/InheritedEntriesDocumentableFilterTransformer.kt index a1b5052d..2e4b29ff 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/InheritedEntriesDocumentableFilterTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/InheritedEntriesDocumentableFilterTransformer.kt @@ -6,8 +6,12 @@ import org.jetbrains.dokka.plugability.DokkaContext class InheritedEntriesDocumentableFilterTransformer(context: DokkaContext) : SuppressedByConditionDocumentableFilterTransformer(context) { - override fun shouldBeSuppressed(d: Documentable): Boolean = - context.configuration.suppressInheritedMembers && (d as? WithExtraProperties<Documentable>)?.extra?.get( - InheritedMember - )?.inheritedFrom?.any { entry -> entry.value != null } ?: false + + override fun shouldBeSuppressed(d: Documentable): Boolean { + @Suppress("UNCHECKED_CAST") + val inheritedMember = (d as? WithExtraProperties<Documentable>)?.extra?.get(InheritedMember) + val containsInheritedFrom = inheritedMember?.inheritedFrom?.any { entry -> entry.value != null } ?: false + + return context.configuration.suppressInheritedMembers && containsInheritedFrom + } }
\ No newline at end of file diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt index c38edea8..85b082ef 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt @@ -15,17 +15,18 @@ open class DocTagToContentConverter : CommentsToContentConverter { dci: DCI, sourceSets: Set<DokkaSourceSet>, styles: Set<Style>, - extra: PropertyContainer<ContentNode> + extras: PropertyContainer<ContentNode> ): List<ContentNode> { fun buildChildren(docTag: DocTag, newStyles: Set<Style> = emptySet(), newExtras: SimpleAttr? = null) = docTag.children.flatMap { - buildContent(it, dci, sourceSets, styles + newStyles, newExtras?.let { extra + it } ?: extra) + buildContent(it, dci, sourceSets, styles + newStyles, newExtras?.let { extras + it } ?: extras) } fun buildTableRows(rows: List<DocTag>, newStyle: Style): List<ContentGroup> = rows.flatMap { - buildContent(it, dci, sourceSets, styles + newStyle, extra) as List<ContentGroup> + @Suppress("UNCHECKED_CAST") + buildContent(it, dci, sourceSets, styles + newStyle, extras) as List<ContentGroup> } fun buildHeader(level: Int) = @@ -70,7 +71,7 @@ open class DocTagToContentConverter : CommentsToContentConverter { is Ul -> buildList(false) is Ol -> buildList(true, start = docTag.params["start"]?.toInt() ?: 1) is Li -> listOf( - ContentGroup(buildChildren(docTag), dci, sourceSets.toDisplaySourceSets(), styles, extra) + ContentGroup(buildChildren(docTag), dci, sourceSets.toDisplaySourceSets(), styles, extras) ) is Dl -> buildList(false, newStyles = setOf(ListStyle.DescriptionList)) is Dt -> listOf( @@ -98,7 +99,7 @@ open class DocTagToContentConverter : CommentsToContentConverter { dci, sourceSets.toDisplaySourceSets(), styles + setOf(TextStyle.Paragraph), - extra + extras ) ) is A -> listOf( @@ -147,7 +148,7 @@ open class DocTagToContentConverter : CommentsToContentConverter { dci = dci, sourceSets = sourceSets.toDisplaySourceSets(), style = styles, - extra = extra + extra = extras ) ) is HorizontalRule -> listOf( @@ -164,7 +165,7 @@ open class DocTagToContentConverter : CommentsToContentConverter { dci, sourceSets.toDisplaySourceSets(), styles, - extra + HtmlContent.takeIf { docTag.params["content-type"] == "html" } + extras + HtmlContent.takeIf { docTag.params["content-type"] == "html" } ) ) is Strikethrough -> buildChildren(docTag, setOf(TextStyle.Strikethrough)) @@ -182,7 +183,7 @@ open class DocTagToContentConverter : CommentsToContentConverter { dci, sourceSets.toDisplaySourceSets(), styles, - extra + extras ) }, buildTableRows(body.filterIsInstance<Tr>(), CommentTable), @@ -208,7 +209,7 @@ open class DocTagToContentConverter : CommentsToContentConverter { is Tr -> listOf( ContentGroup( docTag.children.map { - ContentGroup(buildChildren(it), dci, sourceSets.toDisplaySourceSets(), styles, extra) + ContentGroup(buildChildren(it), dci, sourceSets.toDisplaySourceSets(), styles, extras) }, dci, sourceSets.toDisplaySourceSets(), @@ -230,7 +231,7 @@ open class DocTagToContentConverter : CommentsToContentConverter { dci, sourceSets.toDisplaySourceSets(), styles, - extra = extra + extra = extras ) ) } else { @@ -242,7 +243,7 @@ open class DocTagToContentConverter : CommentsToContentConverter { dci, sourceSets.toDisplaySourceSets(), styles + ContentStyle.Caption, - extra = extra + extra = extras ) ) diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index 91848963..85ec1d07 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -14,7 +14,6 @@ import org.jetbrains.dokka.analysis.from import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.parsers.MarkdownParser import org.jetbrains.dokka.base.translators.psi.parsers.JavadocParser -import org.jetbrains.dokka.base.translators.psi.DefaultPsiToDocumentableTranslator import org.jetbrains.dokka.base.translators.typeConstructorsBeingExceptions import org.jetbrains.dokka.base.translators.unquotedValue import org.jetbrains.dokka.links.* @@ -96,8 +95,7 @@ class DefaultDescriptorToDocumentableTranslator( return DokkaDescriptorVisitor(sourceSet, kotlinAnalysis[sourceSet].facade, context.logger).run { packageFragments.mapNotNull { it.safeAs<PackageFragmentDescriptor>() }.parallelMap { visitPackageFragmentDescriptor( - it, - DRIWithPlatformInfo(DRI.topLevel, emptyMap()) + it ) } }.let { @@ -145,20 +143,17 @@ private class DokkaDescriptorVisitor( private fun <T> T.toSourceSetDependent() = if (this != null) mapOf(sourceSet to this) else emptyMap() - suspend fun visitPackageFragmentDescriptor( - descriptor: PackageFragmentDescriptor, - parent: DRIWithPlatformInfo - ): DPackage { + suspend fun visitPackageFragmentDescriptor(descriptor: PackageFragmentDescriptor): DPackage { val name = descriptor.fqName.asString().takeUnless { it.isBlank() } ?: "" val driWithPlatform = DRI(packageName = name).withEmptyInfo() val scope = descriptor.getMemberScope() return coroutineScope { val descriptorsWithKind = scope.getDescriptorsWithKind(true) - val functions = async { descriptorsWithKind.functions.visitFunctions(driWithPlatform) } - val properties = async { descriptorsWithKind.properties.visitProperties(driWithPlatform) } + val functions = async { descriptorsWithKind.functions.visitFunctions() } + val properties = async { descriptorsWithKind.properties.visitProperties() } val classlikes = async { descriptorsWithKind.classlikes.visitClasslikes(driWithPlatform) } - val typealiases = async { descriptorsWithKind.typealiases.visitTypealiases(driWithPlatform) } + val typealiases = async { descriptorsWithKind.typealiases.visitTypealiases() } DPackage( dri = driWithPlatform.dri, @@ -191,8 +186,8 @@ private class DokkaDescriptorVisitor( return coroutineScope { val descriptorsWithKind = scope.getDescriptorsWithKind() - val functions = async { descriptorsWithKind.functions.visitFunctions(driWithPlatform) } - val properties = async { descriptorsWithKind.properties.visitProperties(driWithPlatform) } + val functions = async { descriptorsWithKind.functions.visitFunctions() } + val properties = async { descriptorsWithKind.properties.visitProperties() } val classlikes = async { descriptorsWithKind.classlikes.visitClasslikes(driWithPlatform) } val generics = async { descriptor.declaredTypeParameters.parallelMap { it.toVariantTypeParameter() } } @@ -232,8 +227,8 @@ private class DokkaDescriptorVisitor( return coroutineScope { val descriptorsWithKind = scope.getDescriptorsWithKind() - val functions = async { descriptorsWithKind.functions.visitFunctions(driWithPlatform) } - val properties = async { descriptorsWithKind.properties.visitProperties(driWithPlatform) } + val functions = async { descriptorsWithKind.functions.visitFunctions() } + val properties = async { descriptorsWithKind.properties.visitProperties() } val classlikes = async { descriptorsWithKind.classlikes.visitClasslikes(driWithPlatform) } DObject( @@ -271,8 +266,8 @@ private class DokkaDescriptorVisitor( return coroutineScope { val descriptorsWithKind = scope.getDescriptorsWithKind() - val functions = async { descriptorsWithKind.functions.visitFunctions(driWithPlatform) } - val properties = async { descriptorsWithKind.properties.visitProperties(driWithPlatform) } + val functions = async { descriptorsWithKind.functions.visitFunctions() } + val properties = async { descriptorsWithKind.properties.visitProperties() } val classlikes = async { descriptorsWithKind.classlikes.visitClasslikes(driWithPlatform) } val constructors = async { descriptor.constructors.parallelMap { visitConstructorDescriptor(it, driWithPlatform) } } @@ -311,8 +306,8 @@ private class DokkaDescriptorVisitor( return coroutineScope { val descriptorsWithKind = scope.getDescriptorsWithKind() - val functions = async { descriptorsWithKind.functions.visitFunctions(driWithPlatform) } - val properties = async { descriptorsWithKind.properties.visitProperties(driWithPlatform) } + val functions = async { descriptorsWithKind.functions.visitFunctions() } + val properties = async { descriptorsWithKind.properties.visitProperties() } val classlikes = async { descriptorsWithKind.classlikes.visitClasslikes(driWithPlatform) } DEnumEntry( @@ -342,8 +337,8 @@ private class DokkaDescriptorVisitor( return coroutineScope { val descriptorsWithKind = scope.getDescriptorsWithKind() - val functions = async { descriptorsWithKind.functions.visitFunctions(driWithPlatform) } - val properties = async { descriptorsWithKind.properties.visitProperties(driWithPlatform) } + val functions = async { descriptorsWithKind.functions.visitFunctions() } + val properties = async { descriptorsWithKind.properties.visitProperties() } val classlikes = async { descriptorsWithKind.classlikes.visitClasslikes(driWithPlatform) } val generics = async { descriptor.declaredTypeParameters.parallelMap { it.toVariantTypeParameter() } } val constructors = @@ -385,8 +380,8 @@ private class DokkaDescriptorVisitor( return coroutineScope { val descriptorsWithKind = scope.getDescriptorsWithKind() - val functions = async { descriptorsWithKind.functions.visitFunctions(driWithPlatform) } - val properties = async { descriptorsWithKind.properties.visitProperties(driWithPlatform) } + val functions = async { descriptorsWithKind.functions.visitFunctions() } + val properties = async { descriptorsWithKind.properties.visitProperties() } val classlikes = async { descriptorsWithKind.classlikes.visitClasslikes(driWithPlatform) } val generics = async { descriptor.declaredTypeParameters.parallelMap { it.toVariantTypeParameter() } } val constructors = async { @@ -426,10 +421,7 @@ private class DokkaDescriptorVisitor( } } - private suspend fun visitPropertyDescriptor( - originalDescriptor: PropertyDescriptor, - parent: DRIWithPlatformInfo - ): DProperty { + private suspend fun visitPropertyDescriptor(originalDescriptor: PropertyDescriptor): DProperty { val (dri, inheritedFrom) = originalDescriptor.createDRI() val descriptor = originalDescriptor.getConcreteDescriptor() val isExpect = descriptor.isExpect @@ -481,10 +473,7 @@ private class DokkaDescriptorVisitor( else overriddenDescriptors.first().createDRI(DRI.from(this)) - private suspend fun visitFunctionDescriptor( - originalDescriptor: FunctionDescriptor, - parent: DRIWithPlatformInfo - ): DFunction { + private suspend fun visitFunctionDescriptor(originalDescriptor: FunctionDescriptor): DFunction { val (dri, inheritedFrom) = originalDescriptor.createDRI() val descriptor = originalDescriptor.getConcreteDescriptor() val isExpect = descriptor.isExpect @@ -675,7 +664,7 @@ private class DokkaDescriptorVisitor( } } - private suspend fun visitTypeAliasDescriptor(descriptor: TypeAliasDescriptor, parent: DRIWithPlatformInfo?) = + private suspend fun visitTypeAliasDescriptor(descriptor: TypeAliasDescriptor) = with(descriptor) { coroutineScope { val generics = async { descriptor.declaredTypeParameters.parallelMap { it.toVariantTypeParameter() } } @@ -742,6 +731,7 @@ private class DokkaDescriptorVisitor( } } + @Suppress("UNCHECKED_CAST") return DescriptorsWithKind( (groupedDescriptors[FunctionDescriptor::class] ?: emptyList()) as List<FunctionDescriptor>, (groupedDescriptors[PropertyDescriptor::class] ?: emptyList()) as List<PropertyDescriptor>, @@ -751,17 +741,17 @@ private class DokkaDescriptorVisitor( ) } - private suspend fun List<FunctionDescriptor>.visitFunctions(parent: DRIWithPlatformInfo): List<DFunction> = - coroutineScope { parallelMap { visitFunctionDescriptor(it, parent) } } + private suspend fun List<FunctionDescriptor>.visitFunctions(): List<DFunction> = + coroutineScope { parallelMap { visitFunctionDescriptor(it) } } - private suspend fun List<PropertyDescriptor>.visitProperties(parent: DRIWithPlatformInfo): List<DProperty> = - coroutineScope { parallelMap { visitPropertyDescriptor(it, parent) } } + private suspend fun List<PropertyDescriptor>.visitProperties(): List<DProperty> = + coroutineScope { parallelMap { visitPropertyDescriptor(it) } } private suspend fun List<ClassDescriptor>.visitClasslikes(parent: DRIWithPlatformInfo): List<DClasslike> = coroutineScope { parallelMap { visitClassDescriptor(it, parent) } } - private suspend fun List<TypeAliasDescriptor>.visitTypealiases(parent: DRIWithPlatformInfo): List<DTypeAlias> = - coroutineScope { parallelMap { visitTypeAliasDescriptor(it, parent) } } + private suspend fun List<TypeAliasDescriptor>.visitTypealiases(): List<DTypeAlias> = + coroutineScope { parallelMap { visitTypeAliasDescriptor(it) } } private suspend fun List<ClassDescriptor>.visitEnumEntries(parent: DRIWithPlatformInfo): List<DEnumEntry> = coroutineScope { parallelMap { visitEnumEntryDescriptor(it, parent) } } @@ -972,7 +962,7 @@ private class DokkaDescriptorVisitor( private fun ConstantValue<*>.toValue(): AnnotationParameterValue = when (this) { is ConstantsAnnotationValue -> AnnotationValue(value.toAnnotation()) - is ConstantsArrayValue -> ArrayValue(value.mapNotNull { it.toValue() }) + is ConstantsArrayValue -> ArrayValue(value.map { it.toValue() }) is ConstantsEnumValue -> EnumValue( fullEnumEntryName(), DRI(enumClassId.packageFqName.asString(), fullEnumEntryName()) @@ -1005,9 +995,7 @@ private class DokkaDescriptorVisitor( private fun AnnotationDescriptor.toAnnotation(scope: Annotations.AnnotationScope = Annotations.AnnotationScope.DIRECT): Annotations.Annotation = Annotations.Annotation( DRI.from(annotationClass as DeclarationDescriptor), - allValueArguments.map { it.key.asString() to it.value.toValue() }.filter { - it.second != null - }.toMap(), + allValueArguments.map { it.key.asString() to it.value.toValue() }.toMap(), mustBeDocumented(), scope ) @@ -1027,9 +1015,14 @@ private class DokkaDescriptorVisitor( } } - private fun <T : CallableMemberDescriptor> T.getConcreteDescriptor(): T = - if (kind != CallableMemberDescriptor.Kind.FAKE_OVERRIDE) this - else overriddenDescriptors.first().getConcreteDescriptor() as T + private fun <T : CallableMemberDescriptor> T.getConcreteDescriptor(): T { + return if (kind != CallableMemberDescriptor.Kind.FAKE_OVERRIDE) { + this + } else { + @Suppress("UNCHECKED_CAST") + overriddenDescriptors.first().getConcreteDescriptor() as T + } + } private fun ValueParameterDescriptor.getDefaultValue(): Expression? = ((source as? KotlinSourceElement)?.psi as? KtParameter)?.defaultValue?.toDefaultValueExpression() diff --git a/plugins/base/src/test/kotlin/basic/DRITest.kt b/plugins/base/src/test/kotlin/basic/DRITest.kt index 57e05858..3a4ff84d 100644 --- a/plugins/base/src/test/kotlin/basic/DRITest.kt +++ b/plugins/base/src/test/kotlin/basic/DRITest.kt @@ -190,7 +190,7 @@ class DRITest : BaseAbstractTest() { ) { pagesGenerationStage = { module -> val sampleClass = module.dfs { it.name == "Sample" } as ClasslikePageNode - val classDocumentable = sampleClass.documentable as DClass + val classDocumentable = sampleClass.documentables.firstOrNull() as DClass assertEquals( "example/Sample///PointingToDeclaration/", sampleClass.dri.first().toString()) assertEquals("example/Sample///PointingToGenericParameters(0)/", classDocumentable.generics.first().dri.toString()) @@ -224,7 +224,7 @@ class DRITest : BaseAbstractTest() { pagesGenerationStage = { module -> val sampleClass = module.dfs { it.name == "Sample" } as ClasslikePageNode val functionNode = sampleClass.children.first { it.name == "genericFun" } as MemberPageNode - val functionDocumentable = functionNode.documentable as DFunction + val functionDocumentable = functionNode.documentables.firstOrNull() as DFunction val parameter = functionDocumentable.parameters.first() assertEquals("example/Sample/genericFun/#kotlin.String/PointingToDeclaration/", functionNode.dri.first().toString()) @@ -269,9 +269,10 @@ class DRITest : BaseAbstractTest() { val sampleClass = module.dfs { it.name == "Sample" } as ClasslikePageNode val sampleInner = sampleClass.children.first { it.name == "SampleInner" } as ClasslikePageNode val foo = sampleInner.children.first { it.name == "foo" } as MemberPageNode - val documentable = foo.documentable as DFunction + val documentable = foo.documentables.firstOrNull() as DFunction - assertEquals((sampleClass.documentable as WithGenerics).generics.first().dri.toString(), (documentable.type as TypeParameter).dri.toString()) + val generics = (sampleClass.documentables.firstOrNull() as WithGenerics).generics + assertEquals(generics.first().dri.toString(), (documentable.type as TypeParameter).dri.toString()) assertEquals(0, documentable.generics.size) } } @@ -298,7 +299,7 @@ class DRITest : BaseAbstractTest() { ) { pagesGenerationStage = { module -> val extensionFunction = module.dfs { it.name == "extensionFunction" } as MemberPageNode - val documentable = extensionFunction.documentable as DFunction + val documentable = extensionFunction.documentables.firstOrNull() as DFunction assertEquals( "example//extensionFunction/kotlin.collections.List[TypeParam(bounds=[kotlin.Any?])]#/PointingToDeclaration/", diff --git a/plugins/base/src/test/kotlin/content/ContentInDescriptionTest.kt b/plugins/base/src/test/kotlin/content/ContentInDescriptionTest.kt index b44eb651..e5533a7e 100644 --- a/plugins/base/src/test/kotlin/content/ContentInDescriptionTest.kt +++ b/plugins/base/src/test/kotlin/content/ContentInDescriptionTest.kt @@ -1,9 +1,9 @@ package content -import junit.framework.Assert.assertEquals import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.doc.* import org.junit.jupiter.api.Test +import kotlin.test.assertEquals import kotlin.test.assertTrue class ContentInDescriptionTest : BaseAbstractTest() { diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt index 664b8282..50580afc 100644 --- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt +++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt @@ -1412,7 +1412,7 @@ class ContentForParamsTest : BaseAbstractTest() { it is MemberPageNode && it.dri.first() .toString() == "test/Main/sample/#java.lang.String#java.lang.String/PointingToDeclaration/" } as MemberPageNode - val forJvm = (sampleFunction.documentable as DFunction).parameters.mapNotNull { + val forJvm = (sampleFunction.documentables.firstOrNull() as DFunction).parameters.mapNotNull { val jvm = it.documentation.keys.first { it.analysisPlatform == Platform.jvm } it.documentation[jvm] } diff --git a/plugins/base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt b/plugins/base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt index 5bd152dc..164fa62d 100644 --- a/plugins/base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt +++ b/plugins/base/src/test/kotlin/content/properties/ContentForClassWithParamsAndPropertiesTest.kt @@ -24,7 +24,7 @@ class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { propertyTest { rootPage -> val node = rootPage.dfs { it.name == "LoadInitialParams" } as ClasslikePageNode val actualDocsForPlaceholdersEnabled = - (node.documentable as DClass).constructors.first().parameters.find { it.name == "placeholdersEnabled" } + (node.documentables.firstOrNull() as DClass).constructors.first().parameters.find { it.name == "placeholdersEnabled" } ?.documentation?.entries?.first()?.value assertEquals(DocumentationNode(listOf(docsForPlaceholdersEnabled)), actualDocsForPlaceholdersEnabled) } @@ -35,7 +35,7 @@ class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { propertyTest { rootPage -> val node = rootPage.dfs { it.name == "LoadInitialParams" } as ClasslikePageNode val actualDocsForRequestedLoadSize = - (node.documentable as DClass).constructors.first().parameters.find { it.name == "requestedLoadSize" } + (node.documentables.firstOrNull() as DClass).constructors.first().parameters.find { it.name == "requestedLoadSize" } ?.documentation?.entries?.first()?.value assertEquals(DocumentationNode(listOf(docsForRequestedLoadSize)), actualDocsForRequestedLoadSize) } @@ -47,7 +47,7 @@ class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { val node = rootPage.dfs { it.name == "LoadInitialParams" } as ClasslikePageNode val actualDocsForRequestedInitialKey = - (node.documentable as DClass).constructors.first().parameters.find { it.name == "requestedInitialKey" } + (node.documentables.firstOrNull() as DClass).constructors.first().parameters.find { it.name == "requestedInitialKey" } ?.documentation?.entries?.first()?.value assertEquals(DocumentationNode(listOf(docsForRequestedInitialKey)), actualDocsForRequestedInitialKey) } @@ -71,7 +71,7 @@ class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { val node = rootPage.dfs { it.name == "LoadInitialParams" } as ClasslikePageNode val actualDocs = - (node.documentable as DClass).constructors.first().documentation.entries.first().value + (node.documentables.firstOrNull() as DClass).constructors.first().documentation.entries.first().value assertEquals(DocumentationNode(listOf(constructorDocs, docsForParam)), actualDocs) } } @@ -94,7 +94,7 @@ class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { val node = rootPage.dfs { it.name == "LoadInitialParams" } as ClasslikePageNode val actualDocs = - (node.documentable as DClass).documentation.entries.first().value + (node.documentables.firstOrNull() as DClass).documentation.entries.first().value assertEquals( DocumentationNode( listOf( @@ -129,7 +129,7 @@ class ContentForClassWithParamsAndPropertiesTest : BaseAbstractTest() { val node = rootPage.dfs { it.name == "ItemKeyedDataSource" } as ClasslikePageNode val actualDocs = - (node.documentable as DClass).properties.first().documentation.entries.first().value + (node.documentables.firstOrNull() as DClass).properties.first().documentation.entries.first().value assertEquals( DocumentationNode(listOf(ownDescription)), actualDocs diff --git a/plugins/base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt b/plugins/base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt index e566320c..d7399914 100644 --- a/plugins/base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt +++ b/plugins/base/src/test/kotlin/content/receiver/ContentForReceiverTest.kt @@ -1,7 +1,5 @@ package content.receiver -import junit.framework.Assert.assertEquals -import junit.framework.Assert.assertNotNull import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.model.doc.Receiver @@ -11,6 +9,8 @@ import org.jetbrains.dokka.pages.ContentText import org.jetbrains.dokka.pages.MemberPageNode import org.junit.jupiter.api.Test import utils.docs +import kotlin.test.assertEquals +import kotlin.test.assertNotNull class ContentForReceiverTest: BaseAbstractTest() { private val testConfiguration = dokkaConfiguration { @@ -40,7 +40,7 @@ class ContentForReceiverTest: BaseAbstractTest() { with(module.packages.flatMap { it.functions }.first()){ val receiver = docs().firstOrNull { it is Receiver } assertNotNull(receiver) - val content = receiver?.dfs { it is Text } as Text + val content = receiver.dfs { it is Text } as Text assertEquals("docs for string", content.body) } } diff --git a/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt b/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt index d1b8153d..1d86f219 100644 --- a/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt +++ b/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt @@ -52,7 +52,7 @@ abstract class AbstractExpectTest( excludes: List<String>, timeout: Long = 500 ) { - obtained?.let { path -> + obtained?.let { _ -> val (res, out, err) = runDiff(expected, obtained, excludes, timeout) assertTrue(res == 0, "Outputs differ:\nstdout - $out\n\nstderr - ${err ?: ""}") } ?: throw AssertionError("obtained path is null") diff --git a/plugins/base/src/test/kotlin/expectActuals/ExpectActualsTest.kt b/plugins/base/src/test/kotlin/expectActuals/ExpectActualsTest.kt index e7c45abd..13d4b456 100644 --- a/plugins/base/src/test/kotlin/expectActuals/ExpectActualsTest.kt +++ b/plugins/base/src/test/kotlin/expectActuals/ExpectActualsTest.kt @@ -43,42 +43,42 @@ class ExpectActualsTest : BaseAbstractTest() { sourceRoots = listOf("src/commonN2Main/kotlin/pageMerger/Test.kt") dependentSourceSets = setOf(common.value.sourceSetID) } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" dependentSourceSets = setOf(commonJ.value.sourceSetID) sourceRoots = listOf("src/jsMain/kotlin/pageMerger/Test.kt") } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" dependentSourceSets = setOf(commonJ.value.sourceSetID) sourceRoots = listOf("src/jvmMain/kotlin/pageMerger/Test.kt") } - val linuxX64 = sourceSet { + sourceSet { name = "linuxX64" displayName = "linuxX64" analysisPlatform = "native" dependentSourceSets = setOf(commonN1.value.sourceSetID) sourceRoots = listOf("src/linuxX64Main/kotlin/pageMerger/Test.kt") } - val mingwX64 = sourceSet { + sourceSet { name = "mingwX64" displayName = "mingwX64" analysisPlatform = "native" dependentSourceSets = setOf(commonN1.value.sourceSetID) sourceRoots = listOf("src/mingwX64Main/kotlin/pageMerger/Test.kt") } - val iosArm64 = sourceSet { + sourceSet { name = "iosArm64" displayName = "iosArm64" analysisPlatform = "native" dependentSourceSets = setOf(commonN2.value.sourceSetID) sourceRoots = listOf("src/iosArm64Main/kotlin/pageMerger/Test.kt") } - val iosX64 = sourceSet { + sourceSet { name = "iosX64" displayName = "iosX64" analysisPlatform = "native" @@ -149,19 +149,19 @@ class ExpectActualsTest : BaseAbstractTest() { val noClass = allChildren.filter { it.name == "A" } assertTrue(commonJ.size == 1) { "There can be only one [jvm, js]A page" } assertTrue( - commonJ.first().documentable?.sourceSets?.map { it.displayName } + commonJ.first().documentables.firstOrNull()?.sourceSets?.map { it.displayName } ?.containsAll(listOf("commonJ", "js", "jvm")) ?: false ) { "A(jvm, js)should have commonJ, js, jvm sources" } assertTrue(commonN1.size == 1) { "There can be only one [mingwX64, linuxX64]A page" } assertTrue( - commonN1.first().documentable?.sourceSets?.map { it.displayName } + commonN1.first().documentables.firstOrNull()?.sourceSets?.map { it.displayName } ?.containsAll(listOf("commonN1", "linuxX64", "mingwX64")) ?: false ) { "[mingwX64, linuxX64]A should have commonN1, linuxX64, mingwX64 sources" } assertTrue(commonN2.size == 1) { "There can be only one [iosX64, iosArm64]A page" } assertTrue( - commonN2.first().documentable?.sourceSets?.map { it.displayName } + commonN2.first().documentables.firstOrNull()?.sourceSets?.map { it.displayName } ?.containsAll(listOf("commonN2", "iosArm64", "iosX64")) ?: false ) { "[iosX64, iosArm64]A should have commonN2, iosArm64, iosX64 sources" } diff --git a/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt b/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt index e6acec92..efab9aba 100644 --- a/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt +++ b/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt @@ -225,6 +225,7 @@ class JavaVisibilityFilterTest : BaseAbstractTest() { ) companion object TestDataSources { + @Suppress("DEPRECATION") // for includeNonPublic val globalExcludes = dokkaConfiguration { sourceSets { sourceSet { @@ -234,6 +235,7 @@ class JavaVisibilityFilterTest : BaseAbstractTest() { } } + @Suppress("DEPRECATION") // for includeNonPublic val globalIncludes = dokkaConfiguration { sourceSets { sourceSet { @@ -243,6 +245,7 @@ class JavaVisibilityFilterTest : BaseAbstractTest() { } } + @Suppress("DEPRECATION") // for includeNonPublic val globalIncludesPackageExcludes = dokkaConfiguration { sourceSets { sourceSet { @@ -251,17 +254,18 @@ class JavaVisibilityFilterTest : BaseAbstractTest() { perPackageOptions = mutableListOf( PackageOptionsImpl( "basic", - false, - false, - false, - false, - DokkaDefaults.documentedVisibilities + includeNonPublic = false, + reportUndocumented = false, + skipDeprecated = false, + suppress = false, + documentedVisibilities = DokkaDefaults.documentedVisibilities ) ) } } } + @Suppress("DEPRECATION") // for includeNonPublic val globalExcludesPackageIncludes = dokkaConfiguration { sourceSets { sourceSet { diff --git a/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt b/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt index 3b333445..c89234f8 100644 --- a/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt +++ b/plugins/base/src/test/kotlin/filter/VisibilityFilterTest.kt @@ -372,6 +372,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `should choose new documentedVisibilities over deprecated includeNonPublic`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -404,6 +405,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - public function with false global`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -435,6 +437,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - private function with false global`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -466,6 +469,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - private function with true global`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -497,6 +501,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `private setter with false global includeNonPublic`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -528,6 +533,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - private function with false global true package`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -569,6 +575,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - private function with true global false package`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -610,6 +617,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - private typealias should be skipped`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -636,6 +644,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - internal property from enum should be skipped`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -675,6 +684,7 @@ class VisibilityFilterTest : BaseAbstractTest() { @Test fun `includeNonPublic - internal property from enum`() { + @Suppress("DEPRECATION") val configuration = dokkaConfiguration { sourceSets { sourceSet { diff --git a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt index 3b0f6eef..1a4bb330 100644 --- a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt +++ b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt @@ -39,7 +39,7 @@ class LinkableContentTest : BaseAbstractTest() { dependentSourceSets = setOf(common.value.sourceSetID) sourceRoots = listOf(Paths.get("$testDataDir/jvmAndJsSecondCommonMain/kotlin").toString()) } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" @@ -47,7 +47,7 @@ class LinkableContentTest : BaseAbstractTest() { sourceRoots = listOf(Paths.get("$testDataDir/jsMain/kotlin").toString()) includes = listOf(Paths.get("$includesDir/include2.md").toString()) } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" @@ -91,7 +91,7 @@ class LinkableContentTest : BaseAbstractTest() { dependentSourceSets = setOf(common.value.sourceSetID) sourceRoots = listOf(Paths.get("$testDataDir/jvmAndJsSecondCommonMain/kotlin").toString()) } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" @@ -105,7 +105,7 @@ class LinkableContentTest : BaseAbstractTest() { ) ) } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" @@ -165,7 +165,7 @@ class LinkableContentTest : BaseAbstractTest() { dependentSourceSets = setOf(common.value.sourceSetID) sourceRoots = listOf(Paths.get("$testDataDir/jvmAndJsSecondCommonMain/kotlin").toString()) } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" @@ -173,7 +173,7 @@ class LinkableContentTest : BaseAbstractTest() { sourceRoots = listOf(Paths.get("$testDataDir/jsMain/kotlin").toString()) samples = listOf("$testDataDir/jsMain/resources/Samples.kt") } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" @@ -192,9 +192,9 @@ class LinkableContentTest : BaseAbstractTest() { Assertions.assertEquals(1, moduleChildren.size) val packageChildren = moduleChildren.first().children Assertions.assertEquals(2, packageChildren.size) - packageChildren.forEach { - val name = it.name.substringBefore("Class") - val classChildren = it.children + packageChildren.forEach { pageNode -> + val name = pageNode.name.substringBefore("Class") + val classChildren = pageNode.children Assertions.assertEquals(2, classChildren.size) val function = classChildren.find { it.name == "printWithExclamation" } val text = function.cast<MemberPageNode>().content.cast<ContentGroup>().children.last() @@ -256,7 +256,7 @@ class LinkableContentTest : BaseAbstractTest() { }?.safeAs<ContentDRILink>() Assertions.assertEquals( - (sample.documentable as WithGenerics).generics.first().dri, + (sample.documentables.firstOrNull() as WithGenerics).generics.first().dri, returnTypeNode?.address ) } @@ -323,7 +323,7 @@ class LinkableContentTest : BaseAbstractTest() { dependentSourceSets = setOf(common.value.sourceSetID) sourceRoots = listOf(Paths.get("$testDataDir/jvmAndJsSecondCommonMain/kotlin").toString()) } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" @@ -331,7 +331,7 @@ class LinkableContentTest : BaseAbstractTest() { sourceRoots = listOf(Paths.get("$testDataDir/jsMain/kotlin").toString()) includes = listOf(Paths.get("$includesDir/include2.md").toString()) } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" @@ -346,8 +346,8 @@ class LinkableContentTest : BaseAbstractTest() { } testFromData(configuration) { - documentablesMergingStage = { - it.documentation.entries.single { + documentablesMergingStage = { module -> + module.documentation.entries.single { it.key.displayName == "jvm" }.value.run { Assertions.assertNotNull(dfs { diff --git a/plugins/base/src/test/kotlin/markdown/KDocTest.kt b/plugins/base/src/test/kotlin/markdown/KDocTest.kt index ac8efe6a..fddd41e7 100644 --- a/plugins/base/src/test/kotlin/markdown/KDocTest.kt +++ b/plugins/base/src/test/kotlin/markdown/KDocTest.kt @@ -26,7 +26,7 @@ abstract class KDocTest : BaseAbstractTest() { """.trimMargin() private fun actualDocumentationNode(modulePageNode: ModulePageNode) = - (modulePageNode.documentable?.children?.first() as DPackage) + (modulePageNode.documentables.firstOrNull()?.children?.first() as DPackage) .classlikes.single() .documentation.values.single() diff --git a/plugins/base/src/test/kotlin/markdown/LinkTest.kt b/plugins/base/src/test/kotlin/markdown/LinkTest.kt index 186fe9ee..f141bb06 100644 --- a/plugins/base/src/test/kotlin/markdown/LinkTest.kt +++ b/plugins/base/src/test/kotlin/markdown/LinkTest.kt @@ -74,7 +74,7 @@ class LinkTest : BaseAbstractTest() { val root = rootPageNode.children.single().children.single() as ClasslikePageNode val innerClass = root.children.first { it is ClasslikePageNode } val foo = innerClass.children.first { it.name == "foo" } as MemberPageNode - val destinationDri = (root.documentable as WithGenerics).generics.first().dri.toString() + val destinationDri = (root.documentables.firstOrNull() as WithGenerics).generics.first().dri.toString() assertEquals(destinationDri, "/Outer///PointingToGenericParameters(0)/") assertNotNull(foo.content.dfs { it is ContentDRILink && it.address.toString() == destinationDri }) diff --git a/plugins/base/src/test/kotlin/model/CommentTest.kt b/plugins/base/src/test/kotlin/model/CommentTest.kt index 59b1817a..6a7b2d89 100644 --- a/plugins/base/src/test/kotlin/model/CommentTest.kt +++ b/plugins/base/src/test/kotlin/model/CommentTest.kt @@ -72,7 +72,6 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme |fun tst() = property """ ) { - val p = this with((this / "comment" / "property").cast<DProperty>()) { comments() equals "" } @@ -252,85 +251,4 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme } } } - -// @Test todo - fun directive() { - inlineModelTest( - """ - |/** - | * Summary - | * - | * @sample example1 - | * @sample example2 - | * @sample X.example3 - | * @sample X.Y.example4 - | */ - |val property = "test" - | - |fun example1(node: String) = if (true) { - | println(property) - |} - | - |fun example2(node: String) { - | if (true) { - | println(property) - | } - |} - | - |class X { - | fun example3(node: String) { - | if (true) { - | println(property) - | } - | } - | - | class Y { - | fun example4(node: String) { - | if (true) { - | println(property) - | } - | } - | } - |} - """ - ) { - with((this / "comment" / "property").cast<DProperty>()) { - this - } - } - } - - -// @Test fun directive() { -// checkSourceExistsAndVerifyModel("testdata/comments/directive.kt", defaultModelConfig) { model -> -// with(model.members.single().members.first()) { -// assertEquals("Summary", content.summary.toTestString()) -// with (content.description) { -// assertEqualsIgnoringSeparators(""" -// |[code lang=kotlin] -// |if (true) { -// | println(property) -// |} -// |[/code] -// |[code lang=kotlin] -// |if (true) { -// | println(property) -// |} -// |[/code] -// |[code lang=kotlin] -// |if (true) { -// | println(property) -// |} -// |[/code] -// |[code lang=kotlin] -// |if (true) { -// | println(property) -// |} -// |[/code] -// |""".trimMargin(), toTestString()) -// } -// } -// } -// } - } diff --git a/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt b/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt index 4b410f33..46b13763 100644 --- a/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt +++ b/plugins/base/src/test/kotlin/pageMerger/PageNodeMergerTest.kt @@ -137,14 +137,14 @@ class PageNodeMergerTest : BaseAbstractTest() { analysisPlatform = "common" sourceRoots = listOf("src/commonMain/kotlin/pageMerger/Test.kt") } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" dependentSourceSets = setOf(common.value.sourceSetID) sourceRoots = listOf("src/jsMain/kotlin/pageMerger/Test.kt") } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" @@ -178,10 +178,10 @@ class PageNodeMergerTest : BaseAbstractTest() { val jsClass = allChildren.filter { it.name == "[js]DoNotMerge" } val noClass = allChildren.filter { it.name == "DoNotMerge" } assertTrue(jvmClass.size == 1) { "There can be only one DoNotMerge(jvm) page" } - assertTrue(jvmClass.first().documentable?.sourceSets?.single()?.analysisPlatform?.key == "jvm") { "[jvm]DoNotMerge should have only jvm sources" } + assertTrue(jvmClass.first().documentables.firstOrNull()?.sourceSets?.single()?.analysisPlatform?.key == "jvm") { "[jvm]DoNotMerge should have only jvm sources" } assertTrue(jsClass.size == 1) { "There can be only one DoNotMerge(js) page" } - assertTrue(jsClass.first().documentable?.sourceSets?.single()?.analysisPlatform?.key == "js") { "[js]DoNotMerge should have only js sources" } + assertTrue(jsClass.first().documentables.firstOrNull()?.sourceSets?.single()?.analysisPlatform?.key == "js") { "[js]DoNotMerge should have only js sources" } assertTrue(noClass.isEmpty()) { "There can't be any DoNotMerge page" } } diff --git a/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt b/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt index c77a78fb..3e5ceb75 100644 --- a/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/FormattingUtilsTest.kt @@ -1,11 +1,11 @@ package renderers.html -import junit.framework.Assert.assertEquals import kotlinx.html.body import kotlinx.html.html import kotlinx.html.stream.createHTML import org.jetbrains.dokka.base.renderers.html.buildBreakableText import org.junit.jupiter.api.Test +import kotlin.test.assertEquals class FormattingUtilsTest { @Test diff --git a/plugins/base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt b/plugins/base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt index 8a8586ee..989b82ef 100644 --- a/plugins/base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt +++ b/plugins/base/src/test/kotlin/resourceLinks/ResourceLinksTest.kt @@ -63,7 +63,7 @@ class ResourceLinksTest : BaseAbstractTest() { configuration, pluginOverrides = listOf(TestResourcesAppenderPlugin(absoluteResources + relativeResources), writerPlugin) ) { - renderingStage = { root, context -> + renderingStage = { _, _ -> Jsoup .parse(writerPlugin.writer.contents.getValue("root/example.html")) .head() @@ -114,7 +114,7 @@ class ResourceLinksTest : BaseAbstractTest() { configuration, pluginOverrides = listOf(writerPlugin) ) { - renderingStage = { root, context -> + renderingStage = { _, _ -> run { if (isMultiModule) { assertNull(writerPlugin.writer.contents["images/customImage.svg"]) @@ -179,7 +179,7 @@ class ResourceLinksTest : BaseAbstractTest() { configuration, pluginOverrides = listOf(TestResourcesAppenderPlugin(absoluteResources + relativeResources), writerPlugin) ) { - renderingStage = { root, context -> + renderingStage = { _, _ -> run { assertNull(writerPlugin.writer.contents["scripts/relativePath.js"]) assertNull(writerPlugin.writer.contents["styles/relativePath.js"]) diff --git a/plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt b/plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt index 65ac1224..e7f408f2 100644 --- a/plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt +++ b/plugins/base/src/test/kotlin/signatures/AbstractRenderingTest.kt @@ -27,14 +27,14 @@ abstract class AbstractRenderingTest : BaseAbstractTest() { dependentSourceSets = setOf(common.value.sourceSetID) sourceRoots = listOf(Paths.get("$testDataDir/jvmAndJsSecondCommonMain/kotlin").toString()) } - val js = sourceSet { + sourceSet { name = "js" displayName = "js" analysisPlatform = "js" dependentSourceSets = setOf(common.value.sourceSetID, jvmAndJsSecondCommonMain.value.sourceSetID) sourceRoots = listOf(Paths.get("$testDataDir/jsMain/kotlin").toString()) } - val jvm = sourceSet { + sourceSet { name = "jvm" displayName = "jvm" analysisPlatform = "jvm" diff --git a/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt b/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt index ad3b5d38..33ec2372 100644 --- a/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt +++ b/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt @@ -134,10 +134,10 @@ class MergeImplicitExpectActualDeclarationsTest : BaseAbstractTest() { assertNotNull(classPage, "Tested class not found!") val props = classPage.findSectionWithName("Properties").assertNotNull("Properties") - val prop1 = props.children.singleOrNull().assertNotNull("prop1") + props.children.singleOrNull().assertNotNull("prop1") val functions = classPage.findSectionWithName("Functions").assertNotNull("Functions") - val method1 = functions.children.singleOrNull().assertNotNull("method1") + functions.children.singleOrNull().assertNotNull("method1") } } } @@ -218,7 +218,7 @@ class MergeImplicitExpectActualDeclarationsTest : BaseAbstractTest() { assertNotNull(classPage, "Tested class not found!") val entries = classPage.findSectionWithName("Entries").assertNotNull("Entries") - val entry = entries.children.singleOrNull().assertNotNull("ENTRY") + entries.children.singleOrNull().assertNotNull("ENTRY") val props = classPage.findSectionWithName("Properties").assertNotNull("Properties") assertEquals( diff --git a/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt index fd9fcc5d..79e9f548 100644 --- a/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt +++ b/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt @@ -185,48 +185,50 @@ class DefaultDescriptorToDocumentableTranslatorTest : BaseAbstractTest() { classlikes.zip(testSuites).forEach { (classlike, testSuites) -> testSuites.forEach { testSuite -> when (testSuite) { - is TestSuite.PropertyDoesntExist -> Assert.assertEquals( - "Test for class ${classlike.name} failed", + is TestSuite.PropertyDoesntExist -> assertEquals( null, - classlike.properties.firstOrNull { it.name == testSuite.propertyName }) + classlike.properties.firstOrNull { it.name == testSuite.propertyName }, + "Test for class ${classlike.name} failed" + ) is TestSuite.PropertyExists -> classlike.properties.single { it.name == testSuite.propertyName } .run { - Assert.assertEquals( - "Test for class ${classlike.name} with property $name failed", + assertEquals( testSuite.modifier, - modifier.values.single() + modifier.values.single(), + "Test for class ${classlike.name} with property $name failed" ) - Assert.assertEquals( - "Test for class ${classlike.name} with property $name failed", + assertEquals( testSuite.visibility, - visibility.values.single() + visibility.values.single(), + "Test for class ${classlike.name} with property $name failed" ) - Assert.assertEquals( - "Test for class ${classlike.name} with property $name failed", + assertEquals( testSuite.additionalModifiers, - extra[AdditionalModifiers]?.content?.values?.single() + extra[AdditionalModifiers]?.content?.values?.single(), + "Test for class ${classlike.name} with property $name failed" ) } - is TestSuite.FunctionDoesntExist -> Assert.assertEquals( - "Test for class ${classlike.name} failed", + is TestSuite.FunctionDoesntExist -> assertEquals( null, - classlike.functions.firstOrNull { it.name == testSuite.propertyName }) + classlike.functions.firstOrNull { it.name == testSuite.propertyName }, + "Test for class ${classlike.name} failed" + ) is TestSuite.FunctionExists -> classlike.functions.single { it.name == testSuite.propertyName } .run { - Assert.assertEquals( - "Test for class ${classlike.name} with function $name failed", + assertEquals( testSuite.modifier, - modifier.values.single() + modifier.values.single(), + "Test for class ${classlike.name} with function $name failed" ) - Assert.assertEquals( - "Test for class ${classlike.name} with function $name failed", + assertEquals( testSuite.visibility, - visibility.values.single() + visibility.values.single(), + "Test for class ${classlike.name} with function $name failed" ) - Assert.assertEquals( - "Test for class ${classlike.name} with function $name failed", + assertEquals( testSuite.additionalModifiers, - extra[AdditionalModifiers]?.content?.values?.single() + extra[AdditionalModifiers]?.content?.values?.single(), + "Test for class ${classlike.name} with function $name failed" ) } } @@ -481,6 +483,7 @@ class DefaultDescriptorToDocumentableTranslatorTest : BaseAbstractTest() { @Test fun `derived properties with only public code`() { + @Suppress("DEPRECATION") // for includeNonPublic val configuration = dokkaConfiguration { sourceSets { sourceSet { @@ -666,6 +669,7 @@ class DefaultDescriptorToDocumentableTranslatorTest : BaseAbstractTest() { } } + @Suppress("DEPRECATION") // for includeNonPublic val javaConfiguration = dokkaConfiguration { sourceSets { sourceSet { diff --git a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt index 9f74e219..1213727d 100644 --- a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt +++ b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt @@ -14,6 +14,7 @@ import org.junit.jupiter.api.Test import utils.assertNotNull class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() { + @Suppress("DEPRECATION") // for includeNonPublic val configuration = dokkaConfiguration { sourceSets { sourceSet { diff --git a/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt b/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt index ecde2c77..7510e541 100644 --- a/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt +++ b/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt @@ -12,6 +12,7 @@ import org.jetbrains.dokka.model.doc.Deprecated as DokkaDeprecatedTag import org.jetbrains.dokka.model.doc.Throws as DokkaThrowsTag class JavadocInheritedDocTagsTest : BaseAbstractTest() { + @Suppress("DEPRECATION") // for includeNonPublic private val configuration = dokkaConfiguration { sourceSets { sourceSet { |