diff --git a/build.gradle.kts b/build.gradle.kts index 0e45f9853c..d9ee594337 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { kotlin("jvm") apply false id("java") - id("org.jetbrains.dokka") version "1.5.0" + id("org.jetbrains.dokka") version "1.6.20" id("io.github.gradle-nexus.publish-plugin") } @@ -21,10 +21,13 @@ allprojects { tasks.withType(KotlinCompile::class).all { kotlinOptions { freeCompilerArgs = freeCompilerArgs + listOf( - "-Xopt-in=kotlin.RequiresOptIn", + "-opt-in=kotlin.RequiresOptIn", + "-Xjsr305=strict", "-Xskip-metadata-version-check", - "-Xjsr305=strict" + // need 1.4 support, otherwise there might be problems with Gradle 6.x (it's bundling Kotlin 1.4) + "-Xsuppress-version-warnings" ) + allWarningsAsErrors = true languageVersion = language_version apiVersion = language_version jvmTarget = "1.8" diff --git a/core/src/main/kotlin/configuration.kt b/core/src/main/kotlin/configuration.kt index c7feb22e31..c26faf2877 100644 --- a/core/src/main/kotlin/configuration.kt +++ b/core/src/main/kotlin/configuration.kt @@ -235,7 +235,7 @@ interface DokkaConfiguration : Serializable { interface PackageOptions : Serializable { val matchingRegex: String - @Deprecated(message = "Use [documentedVisibilities] property for a more flexible control over documented visibilities") + @Deprecated("Use [documentedVisibilities] property for a more flexible control over documented visibilities") val includeNonPublic: Boolean val reportUndocumented: Boolean? val skipDeprecated: Boolean diff --git a/core/src/main/kotlin/defaultConfiguration.kt b/core/src/main/kotlin/defaultConfiguration.kt index 3ab1782c79..8c7c8b5da4 100644 --- a/core/src/main/kotlin/defaultConfiguration.kt +++ b/core/src/main/kotlin/defaultConfiguration.kt @@ -37,6 +37,7 @@ data class DokkaSourceSetImpl( override val dependentSourceSets: Set = emptySet(), override val samples: Set = emptySet(), override val includes: Set = emptySet(), + @Deprecated("Use [documentedVisibilities] property for a more flexible control over documented visibilities") override val includeNonPublic: Boolean = DokkaDefaults.includeNonPublic, override val reportUndocumented: Boolean = DokkaDefaults.reportUndocumented, override val skipEmptyPackages: Boolean = DokkaDefaults.skipEmptyPackages, @@ -79,6 +80,7 @@ data class SourceLinkDefinitionImpl( data class PackageOptionsImpl( override val matchingRegex: String, + @Deprecated("Use [documentedVisibilities] property for a more flexible control over documented visibilities") override val includeNonPublic: Boolean, override val reportUndocumented: Boolean?, override val skipDeprecated: Boolean, diff --git a/core/src/main/kotlin/pages/PageNodes.kt b/core/src/main/kotlin/pages/PageNodes.kt index 75e27dccab..c643fd4be1 100644 --- a/core/src/main/kotlin/pages/PageNodes.kt +++ b/core/src/main/kotlin/pages/PageNodes.kt @@ -21,7 +21,7 @@ interface ContentPage : PageNode { val embeddedResources: List @Deprecated("Deprecated. Remove its usages from your code.", - ReplaceWith("documentables.firstOrNull()") + ReplaceWith("this.documentables.firstOrNull()") ) val documentable: Documentable? get() = if (this is WithDocumentables) this.documentables.firstOrNull() else null diff --git a/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt b/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt index 623fcc2de5..50ab3bad9d 100644 --- a/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt +++ b/core/test-api/src/main/kotlin/testApi/testRunner/TestDokkaConfigurationBuilder.kt @@ -106,6 +106,7 @@ class DokkaSourceSetBuilder( var externalDocumentationLinks: List = emptyList(), var sourceLinks: List = emptyList() ) { + @Suppress("DEPRECATION") fun build() = DokkaSourceSetImpl( displayName = displayName, sourceSetID = DokkaSourceSetID(moduleName, name), diff --git a/integration-tests/gradle/projects/it-basic-groovy/build.gradle b/integration-tests/gradle/projects/it-basic-groovy/build.gradle index dc469bba91..f368ed108e 100644 --- a/integration-tests/gradle/projects/it-basic-groovy/build.gradle +++ b/integration-tests/gradle/projects/it-basic-groovy/build.gradle @@ -19,6 +19,23 @@ dokkaHtml { displayName.set("custom") reportUndocumented.set(true) } + + configureEach { + perPackageOption { // testing closures + matchingRegex.set(".*internal.*") + suppress.set(true) + } + + sourceLink { // testing closures + localDirectory.set(file("src/main")) + remoteUrl.set( + new URL( + "https://github.com/Kotlin/dokka/tree/master/" + + "integration-tests/gradle/projects/it-basic-groovy/src/main" + ) + ) + } + } } } diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt index 452b821c9b..4691670578 100644 --- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt +++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt @@ -114,8 +114,11 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl JavadocTagInfo.EP_NAME, JavadocTagInfo::class.java ) + @Suppress("DEPRECATION") + val extensionArea = Extensions.getRootArea() + CoreApplicationEnvironment.registerExtensionPoint( - Extensions.getRootArea(), + extensionArea, CustomJavadocTagProvider.EP_NAME, CustomJavadocTagProvider::class.java ) @@ -588,8 +591,12 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl instances: List, disposable: Disposable ) { - if (Extensions.getRootArea().hasExtensionPoint(appExtension.extensionPointName)) + @Suppress("DEPRECATION") + val extensionArea = Extensions.getRootArea() + + if (extensionArea.hasExtensionPoint(appExtension.extensionPointName)) { return + } appExtension.registerExtensionPoint() instances.forEach { extension -> appExtension.registerExtension(extension, disposable) } diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DokkaResolutionFacade.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DokkaResolutionFacade.kt index c0fafc25da..b278ef6ed3 100644 --- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DokkaResolutionFacade.kt +++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DokkaResolutionFacade.kt @@ -75,6 +75,7 @@ class DokkaResolutionFacade( if (key != element) { throw UnsupportedOperationException() } + @Suppress("UNCHECKED_CAST") return when { slice == BindingContext.DECLARATION_TO_DESCRIPTOR -> descriptor as V slice == BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER && (element as KtParameter).hasValOrVar() -> descriptor as V diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/JvmDependenciesIndexImpl.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/JvmDependenciesIndexImpl.kt index 3632337a7d..c64f2fab2d 100644 --- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/JvmDependenciesIndexImpl.kt +++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/JvmDependenciesIndexImpl.kt @@ -20,7 +20,7 @@ import com.intellij.ide.highlighter.JavaClassFileType import com.intellij.ide.highlighter.JavaFileType import com.intellij.openapi.vfs.VfsUtilCore import com.intellij.openapi.vfs.VirtualFile -import com.intellij.util.containers.IntArrayList +import it.unimi.dsi.fastutil.ints.IntArrayList import gnu.trove.THashMap import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName @@ -54,7 +54,7 @@ class JvmDependenciesIndexImpl(_roots: List) : JvmDependenciesIndex { Cache().apply { roots.indices.forEach(rootIndices::add) rootIndices.add(maxIndex) - rootIndices.trimToSize() + rootIndices.trim() } } @@ -121,8 +121,8 @@ class JvmDependenciesIndexImpl(_roots: List) : JvmDependenciesIndex { // NOTE: indices manipulation instead of using caches.reversed() is here for performance reasons for (cacheIndex in caches.lastIndex downTo 0) { val cacheRootIndices = caches[cacheIndex].rootIndices - for (i in 0 until cacheRootIndices.size()) { - val rootIndex = cacheRootIndices[i] + for (i in 0 until cacheRootIndices.size) { + val rootIndex = cacheRootIndices.getInt(i) if (rootIndex <= processedRootsUpTo) continue // roots with those indices have been processed by now val directoryInRoot = @@ -138,7 +138,12 @@ class JvmDependenciesIndexImpl(_roots: List) : JvmDependenciesIndex { } } } - processedRootsUpTo = if (cacheRootIndices.isEmpty) processedRootsUpTo else cacheRootIndices.get(cacheRootIndices.size() - 1) + processedRootsUpTo = + if (cacheRootIndices.isEmpty) { + processedRootsUpTo + } else { + cacheRootIndices.getInt(cacheRootIndices.size - 1) + } } if (request is FindClassRequest) { @@ -160,7 +165,7 @@ class JvmDependenciesIndexImpl(_roots: List) : JvmDependenciesIndex { for (i in (fillCachesAfter + 1) until cachesPath.size) { // we all know roots that contain this package by now cachesPath[i].rootIndices.add(maxIndex) - cachesPath[i].rootIndices.trimToSize() + cachesPath[i].rootIndices.trim() } return null } diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt index 336b7566b9..22660ecc66 100644 --- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt +++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt @@ -23,7 +23,7 @@ fun TypeReference.Companion.from(d: ReceiverParameterDescriptor): TypeReference? fun TypeReference.Companion.from(d: ValueParameterDescriptor): TypeReference = fromPossiblyNullable(d.type, emptyList()) -fun TypeReference.Companion.from(p: PsiClass) = TypeReference +fun TypeReference.Companion.from(@Suppress("UNUSED_PARAMETER") p: PsiClass) = TypeReference private fun TypeReference.Companion.fromPossiblyNullable(t: KotlinType, paramTrace: List): TypeReference = fromPossiblyRecursive(t, paramTrace).let { if (t.isMarkedNullable) Nullable(it) else it } 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 95dcae4ec2..eeeea265b2 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 75617e0c25..d3006f3365 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 a3cbcc2e2b..ea87dce8a6 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 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 055594697d..7ce41866e2 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().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?, - style: Set