diff options
22 files changed, 1723 insertions, 86 deletions
diff --git a/.idea/compiler.xml b/.idea/compiler.xml index b87e1115..dd174dd7 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -11,7 +11,7 @@ <entry name="!?*.kt" /> <entry name="!?*.clj" /> </wildcardResourcePatterns> - <bytecodeTargetLevel> + <bytecodeTargetLevel target="1.8"> <module name="android-gradle-plugin_main" target="1.8" /> <module name="android-gradle-plugin_test" target="1.8" /> <module name="ant_main" target="1.8" /> @@ -28,62 +28,28 @@ <module name="cli_test" target="1.8" /> <module name="core_main" target="1.8" /> <module name="core_test" target="1.8" /> - <module name="dokka.buildSrc.main" target="1.8" /> - <module name="dokka.buildSrc.test" target="1.8" /> - <module name="dokka.core.main" target="1.8" /> <module name="dokka.core.search-component.main" target="1.8" /> <module name="dokka.core.search-component.test" target="1.8" /> - <module name="dokka.core.test" target="1.8" /> <module name="dokka.core.testApi.main" target="1.8" /> <module name="dokka.core.testApi.test" target="1.8" /> - <module name="dokka.coreDependencies.main" target="1.8" /> - <module name="dokka.coreDependencies.test" target="1.8" /> - <module name="dokka.integration-tests.gradle-integration-tests.main" target="1.8" /> - <module name="dokka.integration-tests.gradle-integration-tests.test" target="1.8" /> - <module name="dokka.integration-tests.main" target="1.8" /> - <module name="dokka.integration-tests.test" target="1.8" /> <module name="dokka.integration.main" target="1.8" /> <module name="dokka.integration.test" target="1.8" /> - <module name="dokka.plugins.base.main" target="1.8" /> <module name="dokka.plugins.base.search-component.main" target="1.8" /> <module name="dokka.plugins.base.search-component.test" target="1.8" /> - <module name="dokka.plugins.base.test" target="1.8" /> - <module name="dokka.plugins.gfm.main" target="1.8" /> - <module name="dokka.plugins.gfm.test" target="1.8" /> <module name="dokka.plugins.javadoc8.main" target="1.8" /> <module name="dokka.plugins.javadoc8.test" target="1.8" /> - <module name="dokka.plugins.jekyll.main" target="1.8" /> - <module name="dokka.plugins.jekyll.test" target="1.8" /> - <module name="dokka.plugins.kotlin-as-java.main" target="1.8" /> - <module name="dokka.plugins.kotlin-as-java.test" target="1.8" /> <module name="dokka.plugins.ma.main" target="1.8" /> <module name="dokka.plugins.ma.test" target="1.8" /> - <module name="dokka.plugins.main" target="1.8" /> - <module name="dokka.plugins.mathjax.main" target="1.8" /> - <module name="dokka.plugins.mathjax.test" target="1.8" /> - <module name="dokka.plugins.test" target="1.8" /> <module name="dokka.plugins.xml.main" target="1.8" /> <module name="dokka.plugins.xml.test" target="1.8" /> <module name="dokka.runners.android-gradle-plugin.main" target="1.8" /> <module name="dokka.runners.android-gradle-plugin.test" target="1.8" /> <module name="dokka.runners.ant.main" target="1.8" /> <module name="dokka.runners.ant.test" target="1.8" /> - <module name="dokka.runners.cli.main" target="1.8" /> - <module name="dokka.runners.cli.test" target="1.8" /> <module name="dokka.runners.fatjar.main" target="1.8" /> <module name="dokka.runners.fatjar.test" target="1.8" /> <module name="dokka.runners.gradle-integration-tests.main" target="1.8" /> <module name="dokka.runners.gradle-integration-tests.test" target="1.8" /> - <module name="dokka.runners.gradle-plugin.main" target="1.8" /> - <module name="dokka.runners.gradle-plugin.test" target="1.8" /> - <module name="dokka.runners.main" target="1.8" /> - <module name="dokka.runners.maven-plugin.main" target="1.8" /> - <module name="dokka.runners.maven-plugin.test" target="1.8" /> - <module name="dokka.runners.test" target="1.8" /> - <module name="dokka.test-tools.main" target="1.8" /> - <module name="dokka.test-tools.test" target="1.8" /> - <module name="dokka.testApi.main" target="1.8" /> - <module name="dokka.testApi.test" target="1.8" /> <module name="fatjar_main" target="1.8" /> <module name="fatjar_test" target="1.8" /> <module name="gradle-integration-tests.dokka.integration-tests.gradle-integration-tests.main" target="1.8" /> diff --git a/.idea/misc.xml b/.idea/misc.xml index e208459b..ff8249e4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> + <component name="FrameworkDetectionExcludesConfiguration"> + <file type="web" url="file://$PROJECT_DIR$" /> + </component> + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <output url="file://$PROJECT_DIR$/out" /> </component> </project>
\ No newline at end of file @@ -604,7 +604,7 @@ Dokka supports the following command line arguments: * `-skipDeprecated` - if set, deprecated elements are not included in the generated documentation * `-reportUndocumented` - warn about undocumented members * `-skipEmptyPackages` - do not create index pages for empty packages - * `-packageOptions` - list of package options in format `prefix,-deprecated,-privateApi,+warnUndocumented;prefix, ...` + * `-packageOptions` - list of package options in format `prefix,-deprecated,-privateApi,+reportUndocumented;prefix, ...` * `-links` - external documentation links in format `url^packageListUrl^^url2...` * `-srcLink` - (repeatable) - mapping between a source directory and a Web site for browsing the code in format `<path>=<url>[#lineSuffix]` * `-noStdlibLink` - disable linking to online kotlin-stdlib documentation diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 14718cfe..1d61e410 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -16,7 +16,7 @@ dependencies { implementation("org.jsoup:jsoup:1.12.1") testImplementation(project(":testApi")) - testImplementation("junit:junit:4.13") + testImplementation(kotlin("test-junit")) } val sourceJar by tasks.registering(Jar::class) { diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt index 56e837fc..d39ee1d5 100644 --- a/core/src/main/kotlin/DokkaBootstrapImpl.kt +++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt @@ -17,7 +17,7 @@ fun parsePerPackageOptions(arg: String): List<PackageOptions> { throw IllegalArgumentException("Please do not register packageOptions with all match pattern, use global settings instead") val args = it.subList(1, it.size) val deprecated = args.find { it.endsWith("deprecated") }?.startsWith("+") ?: true - val reportUndocumented = args.find { it.endsWith("warnUndocumented") }?.startsWith("+") ?: true + val reportUndocumented = args.find { it.endsWith("reportUndocumented") }?.startsWith("+") ?: true val privateApi = args.find { it.endsWith("privateApi") }?.startsWith("+") ?: false val suppress = args.find { it.endsWith("suppress") }?.startsWith("+") ?: false PackageOptionsImpl( diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt index 7f90fe9a..61fb7324 100644 --- a/core/src/main/kotlin/DokkaGenerator.kt +++ b/core/src/main/kotlin/DokkaGenerator.kt @@ -146,7 +146,7 @@ class DokkaGenerator( } pass.classpath.forEach { addClasspath(File(it)) } - addSources((pass.sourceRoots + pass.dependentSourceRoots).map { it.path }) + addSources((pass.sourceRoots + pass.dependentSourceRoots).map { it.path }) loadLanguageVersionSettings(pass.languageVersion, pass.apiVersion) diff --git a/core/src/main/kotlin/configuration.kt b/core/src/main/kotlin/configuration.kt index c38d0234..0b59f301 100644 --- a/core/src/main/kotlin/configuration.kt +++ b/core/src/main/kotlin/configuration.kt @@ -83,7 +83,7 @@ interface DokkaConfiguration { interface PackageOptions { val prefix: String val includeNonPublic: Boolean - val reportUndocumented: Boolean + val reportUndocumented: Boolean? val skipDeprecated: Boolean val suppress: Boolean } diff --git a/core/src/main/kotlin/defaultConfiguration.kt b/core/src/main/kotlin/defaultConfiguration.kt index acfa55d4..7aaa1c89 100644 --- a/core/src/main/kotlin/defaultConfiguration.kt +++ b/core/src/main/kotlin/defaultConfiguration.kt @@ -73,7 +73,7 @@ data class SourceLinkDefinitionImpl( data class PackageOptionsImpl( override val prefix: String, override val includeNonPublic: Boolean, - override val reportUndocumented: Boolean, + override val reportUndocumented: Boolean?, override val skipDeprecated: Boolean, override val suppress: Boolean ): DokkaConfiguration.PackageOptions diff --git a/core/src/main/kotlin/links/DRI.kt b/core/src/main/kotlin/links/DRI.kt index 1c823d92..9cc51fb7 100644 --- a/core/src/main/kotlin/links/DRI.kt +++ b/core/src/main/kotlin/links/DRI.kt @@ -38,12 +38,13 @@ data class DRI( } fun from(psi: PsiElement) = psi.parentsWithSelf.run { - val callable = firstIsInstanceOrNull<PsiMethod>() + val psiMethod = firstIsInstanceOrNull<PsiMethod>() + val psiField = firstIsInstanceOrNull<PsiField>() val classes = filterIsInstance<PsiClass>().toList() DRI( classes.lastOrNull()?.qualifiedName?.substringBeforeLast('.', ""), classes.toList().takeIf { it.isNotEmpty() }?.asReversed()?.mapNotNull { it.name }?.joinToString("."), - callable?.let { Callable.from(it) }, + psiMethod?.let { Callable.from(it) } ?: psiField?.let { Callable.from(it) } , DriTarget.from(psi) ) } @@ -85,12 +86,21 @@ data class Callable( valueParameters.mapNotNull { TypeReference.from(it) } ) } + fun from(psi: PsiMethod) = with(psi) { Callable( name, null, parameterList.parameters.map { param -> JavaClassReference(param.type.canonicalText) }) } + + fun from(psi: PsiField): Callable { + return Callable( + name = psi.name, + receiver = null, + params = emptyList() + ) + } } } @@ -169,11 +179,12 @@ sealed class DriTarget { companion object { fun from(descriptor: DeclarationDescriptor): DriTarget = descriptor.parentsWithSelf.run { - return when(descriptor){ + return when (descriptor) { is TypeParameterDescriptor -> PointingToGenericParameters(descriptor.index) else -> { val callable = firstIsInstanceOrNull<CallableDescriptor>() - val params = callable?.let { listOfNotNull(it.extensionReceiverParameter) + it.valueParameters }.orEmpty() + val params = + callable?.let { listOfNotNull(it.extensionReceiverParameter) + it.valueParameters }.orEmpty() val parameterDescriptor = firstIsInstanceOrNull<ParameterDescriptor>() parameterDescriptor?.let { PointingToCallableParameters(params.indexOf(it)) } @@ -183,7 +194,7 @@ sealed class DriTarget { } fun from(psi: PsiElement): DriTarget = psi.parentsWithSelf.run { - return when(psi) { + return when (psi) { is PsiTypeParameter -> PointingToGenericParameters(psi.index) else -> firstIsInstanceOrNull<PsiParameter>()?.let { val callable = firstIsInstanceOrNull<PsiMethod>() @@ -199,15 +210,15 @@ data class PointingToGenericParameters(val parameterIndex: Int) : DriTarget() { override fun toString(): String = "PointingToGenericParameters($parameterIndex)" } -object PointingToDeclaration: DriTarget() +object PointingToDeclaration : DriTarget() -data class PointingToCallableParameters(val parameterIndex: Int): DriTarget(){ +data class PointingToCallableParameters(val parameterIndex: Int) : DriTarget() { override fun toString(): String = "PointingToCallableParameters($parameterIndex)" } -fun DriTarget.nextTarget(): DriTarget = when(this){ - is PointingToGenericParameters -> PointingToGenericParameters(this.parameterIndex+1) - is PointingToCallableParameters -> PointingToCallableParameters(this.parameterIndex+1) - else -> this - } +fun DriTarget.nextTarget(): DriTarget = when (this) { + is PointingToGenericParameters -> PointingToGenericParameters(this.parameterIndex + 1) + is PointingToCallableParameters -> PointingToCallableParameters(this.parameterIndex + 1) + else -> this +} diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index a7dd0919..c4dabb3b 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -1,8 +1,6 @@ package org.jetbrains.dokka.model import com.intellij.psi.PsiNamedElement -import org.jetbrains.dokka.DokkaConfiguration -import org.jetbrains.dokka.Platform import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.doc.DocumentationNode import org.jetbrains.dokka.model.properties.PropertyContainer @@ -378,6 +376,15 @@ fun Documentable.dfs(predicate: (Documentable) -> Boolean): Documentable? = this.children.asSequence().mapNotNull { it.dfs(predicate) }.firstOrNull() } +fun Documentable.withDescendants(): Sequence<Documentable> { + return sequence { + yield(this@withDescendants) + children.forEach { child -> + yieldAll(child.withDescendants()) + } + } +} + sealed class Visibility(val name: String) sealed class KotlinVisibility(name: String) : Visibility(name) { object Public : KotlinVisibility("public") diff --git a/core/src/test/kotlin/model/DocumentableTest.kt b/core/src/test/kotlin/model/DocumentableTest.kt new file mode 100644 index 00000000..e3031a50 --- /dev/null +++ b/core/src/test/kotlin/model/DocumentableTest.kt @@ -0,0 +1,108 @@ +package model + +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.* +import org.jetbrains.dokka.model.properties.PropertyContainer +import kotlin.test.Test +import kotlin.test.assertEquals + +class DocumentableTest { + + @Test + fun withDescendents() { + val dClass = DClass( + dri = DRI(), + name = "TestClass", + constructors = emptyList(), + classlikes = emptyList(), + companion = null, + documentation = emptyMap(), + expectPresentInSet = null, + extra = PropertyContainer.empty(), + visibility = emptyMap(), + generics = emptyList(), + modifier = emptyMap(), + properties = emptyList(), + sources = emptyMap(), + sourceSets = emptyList(), + supertypes = emptyMap(), + functions = listOf( + DFunction( + dri = DRI(), + name = "function0", + documentation = emptyMap(), + expectPresentInSet = null, + extra = PropertyContainer.empty(), + visibility = emptyMap(), + generics = emptyList(), + modifier = emptyMap(), + sources = emptyMap(), + sourceSets = emptyList(), + type = Void, + receiver = null, + isConstructor = false, + parameters = listOf( + DParameter( + dri = DRI(), + name = "f0p0", + documentation = emptyMap(), + expectPresentInSet = null, + extra = PropertyContainer.empty(), + sourceSets = emptyList(), + type = Void + ), + DParameter( + dri = DRI(), + name = "f0p1", + documentation = emptyMap(), + expectPresentInSet = null, + extra = PropertyContainer.empty(), + sourceSets = emptyList(), + type = Void + ) + ) + ), + DFunction( + dri = DRI(), + name = "function1", + documentation = emptyMap(), + expectPresentInSet = null, + extra = PropertyContainer.empty(), + visibility = emptyMap(), + generics = emptyList(), + modifier = emptyMap(), + sources = emptyMap(), + sourceSets = emptyList(), + type = Void, + receiver = null, + isConstructor = false, + parameters = listOf( + DParameter( + dri = DRI(), + name = "f1p0", + documentation = emptyMap(), + expectPresentInSet = null, + extra = PropertyContainer.empty(), + sourceSets = emptyList(), + type = Void + ), + DParameter( + dri = DRI(), + name = "f1p1", + documentation = emptyMap(), + expectPresentInSet = null, + extra = PropertyContainer.empty(), + sourceSets = emptyList(), + type = Void + ) + ) + ) + ) + ) + + assertEquals( + listOf("TestClass", "function0", "f0p0", "f0p1", "function1", "f1p0", "f1p1"), + dClass.withDescendants().map { it.name }.toList() + ) + } +}
\ No newline at end of file diff --git a/plugins/base/src/main/kotlin/DokkaBase.kt b/plugins/base/src/main/kotlin/DokkaBase.kt index c99372af..7a969b91 100644 --- a/plugins/base/src/main/kotlin/DokkaBase.kt +++ b/plugins/base/src/main/kotlin/DokkaBase.kt @@ -9,12 +9,12 @@ import org.jetbrains.dokka.base.signatures.SignatureProvider import org.jetbrains.dokka.base.resolvers.external.* import org.jetbrains.dokka.base.resolvers.local.DefaultLocationProviderFactory import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory -import org.jetbrains.dokka.base.transformers.documentables.ActualTypealiasAdder +import org.jetbrains.dokka.base.transformers.documentables.* import org.jetbrains.dokka.base.transformers.documentables.DefaultDocumentableMerger -import org.jetbrains.dokka.base.transformers.documentables.InheritorsExtractorTransformer -import org.jetbrains.dokka.base.transformers.pages.annotations.DeprecatedStrikethroughTransformer import org.jetbrains.dokka.base.transformers.documentables.DocumentableVisibilityFilter import org.jetbrains.dokka.base.transformers.documentables.ModuleAndPackageDocumentationTransformer +import org.jetbrains.dokka.base.transformers.documentables.ReportUndocumentedTransformer +import org.jetbrains.dokka.base.transformers.pages.annotations.DeprecatedStrikethroughTransformer import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConverter import org.jetbrains.dokka.base.transformers.pages.merger.FallbackPageMergerStrategy @@ -73,6 +73,10 @@ class DokkaBase : DokkaPlugin() { CoreExtensions.documentableTransformer with ActualTypealiasAdder() } + val undocumentedCodeReporter by extending { + CoreExtensions.documentableTransformer with ReportUndocumentedTransformer() + } + val documentableToPageTranslator by extending(isFallback = true) { CoreExtensions.documentableToPageTranslator providing { ctx -> DefaultDocumentableToPageTranslator( @@ -175,7 +179,7 @@ class DokkaBase : DokkaPlugin() { } val sourcesetDependencyAppender by extending { - htmlPreprocessors providing ::SourcesetDependencyAppender order { after(rootCreator)} + htmlPreprocessors providing ::SourcesetDependencyAppender order { after(rootCreator) } } val allModulePageCreators by extending { diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt new file mode 100644 index 00000000..4aa7632e --- /dev/null +++ b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt @@ -0,0 +1,157 @@ +package org.jetbrains.dokka.base.transformers.documentables + +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.DokkaConfiguration.PassConfiguration +import org.jetbrains.dokka.model.* +import org.jetbrains.dokka.plugability.DokkaContext +import org.jetbrains.dokka.transformers.documentation.DocumentableTransformer +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.FAKE_OVERRIDE +import org.jetbrains.kotlin.utils.addToStdlib.safeAs + +internal class ReportUndocumentedTransformer : DocumentableTransformer { + + override fun invoke(original: DModule, context: DokkaContext): DModule = original.apply { + withDescendants().forEach { documentable -> invoke(documentable, context) } + } + + private fun invoke(documentable: Documentable, context: DokkaContext) { + documentable.sourceSets.forEach { sourceSet -> + if (shouldBeReportedIfNotDocumented(documentable, sourceSet, context)) { + reportIfUndocumented(context, documentable, sourceSet) + } + } + } + + private fun shouldBeReportedIfNotDocumented( + documentable: Documentable, sourceSet: SourceSetData, context: DokkaContext + ): Boolean { + val passConfiguration = passConfiguration(context, sourceSet) + val packageOptionsOrNull = packageOptionsOrNull(passConfiguration, documentable) + + if (!(packageOptionsOrNull?.reportUndocumented ?: passConfiguration.reportUndocumented)) { + return false + } + + if (documentable is DParameter || documentable is DPackage || documentable is DModule) { + return false + } + + if (isConstructor(documentable)) { + return false + } + + if (isFakeOverride(documentable, sourceSet)) { + return false + } + + if (isPrivateOrInternalApi(documentable, sourceSet)) { + return false + } + + return true + } + + private fun reportIfUndocumented( + context: DokkaContext, + documentable: Documentable, + sourceSet: SourceSetData + ) { + if (isUndocumented(documentable, sourceSet)) { + val documentableDescription = with(documentable) { + buildString { + dri.packageName?.run { + append(this) + append("/") + } + + dri.classNames?.run { + append(this) + append("/") + } + + dri.callable?.run { + append(name) + append("/") + append(signature()) + append("/") + } + + val sourceSetName = sourceSet.sourceSetName + if (sourceSetName != null.toString()) { + append(" ($sourceSetName)") + } + } + } + + context.logger.warn("Undocumented: $documentableDescription") + } + } + + private fun isUndocumented(documentable: Documentable, sourceSet: SourceSetData): Boolean { + fun resolveDependentSourceSets(sourceSet: SourceSetData): List<SourceSetData> { + return sourceSet.dependentSourceSets.map { sourceSetName -> + documentable.sourceSets.single { it.sourceSetName == sourceSetName } + } + } + + fun flatDependentSourceSetsTree(sourceSet: SourceSetData): List<SourceSetData> { + return listOf(sourceSet) + resolveDependentSourceSets(sourceSet) + .flatMap { resolveDependentSourceSets -> flatDependentSourceSetsTree(resolveDependentSourceSets) } + } + + return flatDependentSourceSetsTree(sourceSet).all { sourceSetOrDependentSourceSet -> + documentable.documentation[sourceSetOrDependentSourceSet]?.children?.isEmpty() ?: true + } + } + + private fun isConstructor(documentable: Documentable): Boolean { + if (documentable !is DFunction) return false + return documentable.isConstructor + } + + private fun passConfiguration(context: DokkaContext, sourceSet: SourceSetData): PassConfiguration { + return context.configuration.passesConfigurations.single { configuration -> + // TODO: Use sourceSetID after gradle-rewrite + configuration.sourceSetName == sourceSet.sourceSetName && + configuration.analysisPlatform == sourceSet.platform + } + } + + private fun isFakeOverride(documentable: Documentable, sourceSet: SourceSetData): Boolean { + if (documentable is WithExpectActual) { + val callableMemberDescriptor = documentable.sources[sourceSet] + .safeAs<DescriptorDocumentableSource>()?.descriptor + .safeAs<CallableMemberDescriptor>() + + if (callableMemberDescriptor?.kind == FAKE_OVERRIDE) { + return true + } + } + return false + } + + private fun isPrivateOrInternalApi(documentable: Documentable, sourceSet: SourceSetData): Boolean { + return when (documentable.safeAs<WithVisibility>()?.visibility?.get(sourceSet)) { + KotlinVisibility.Public -> false + KotlinVisibility.Private -> true + KotlinVisibility.Protected -> true + KotlinVisibility.Internal -> true + JavaVisibility.Public -> false + JavaVisibility.Private -> true + JavaVisibility.Protected -> true + JavaVisibility.Default -> true + null -> false + } + } + + private fun packageOptionsOrNull( + passConfiguration: PassConfiguration, + documentable: Documentable + ): DokkaConfiguration.PackageOptions? { + val packageName = documentable.dri.packageName ?: return null + return passConfiguration.perPackageOptions + .filter { packageOptions -> packageName.startsWith(packageOptions.prefix) } + .maxBy { packageOptions -> packageOptions.prefix.length } + } +} diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index f3b047bc..9f01267e 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -1,6 +1,5 @@ package org.jetbrains.dokka.base.translators.descriptors -import org.jetbrains.kotlin.descriptors.annotations.Annotated import org.jetbrains.dokka.analysis.DokkaResolutionFacade import org.jetbrains.dokka.links.* import org.jetbrains.dokka.links.Callable @@ -11,15 +10,16 @@ import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.parsers.MarkdownParser import org.jetbrains.dokka.plugability.DokkaContext -import org.jetbrains.dokka.utilities.DokkaLogger import org.jetbrains.dokka.transformers.sources.SourceToDocumentableTranslator -import org.jetbrains.kotlin.asJava.classes.tryResolveMarkerInterfaceFQName +import org.jetbrains.dokka.utilities.DokkaLogger import org.jetbrains.kotlin.builtins.isExtensionFunctionType import org.jetbrains.kotlin.builtins.isFunctionType import org.jetbrains.kotlin.codegen.isJvmStaticInObjectOrClassOrInterface import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.FAKE_OVERRIDE import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.Visibility +import org.jetbrains.kotlin.descriptors.annotations.Annotated import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor import org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorVisitorEmptyBodies import org.jetbrains.kotlin.idea.kdoc.findKDoc @@ -29,15 +29,10 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.resolve.calls.callUtil.getValueArgumentsInParentheses import org.jetbrains.kotlin.resolve.calls.components.isVararg import org.jetbrains.kotlin.resolve.constants.ConstantValue -import org.jetbrains.kotlin.resolve.constants.AnnotationValue as ConstantsAnnotationValue -import org.jetbrains.kotlin.resolve.constants.ArrayValue as ConstantsArrayValue -import org.jetbrains.kotlin.resolve.constants.EnumValue as ConstantsEnumValue -import org.jetbrains.kotlin.resolve.constants.KClassValue as ConstantsKtClassValue -import org.jetbrains.kotlin.resolve.constants.KClassValue.Value.NormalClass import org.jetbrains.kotlin.resolve.constants.KClassValue.Value.LocalClass +import org.jetbrains.kotlin.resolve.constants.KClassValue.Value.NormalClass import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass import org.jetbrains.kotlin.resolve.descriptorUtil.getAllSuperclassesWithoutAny -import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassNotAny import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperInterfaces import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.MemberScope @@ -46,12 +41,13 @@ import org.jetbrains.kotlin.resolve.source.PsiSourceElement import org.jetbrains.kotlin.types.DynamicType import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeProjection -import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull import org.jetbrains.kotlin.utils.addToStdlib.safeAs import java.nio.file.Paths -import kotlin.IllegalArgumentException -import kotlin.reflect.jvm.internal.impl.resolve.constants.KClassValue +import org.jetbrains.kotlin.resolve.constants.AnnotationValue as ConstantsAnnotationValue +import org.jetbrains.kotlin.resolve.constants.ArrayValue as ConstantsArrayValue +import org.jetbrains.kotlin.resolve.constants.EnumValue as ConstantsEnumValue +import org.jetbrains.kotlin.resolve.constants.KClassValue as ConstantsKt |
