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 | |
| 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
75 files changed, 368 insertions, 333 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index 0e45f985..d9ee5943 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 c7feb22e..c26faf28 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 3ab1782c..8c7c8b5d 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<DokkaSourceSetID> = emptySet(), override val samples: Set<File> = emptySet(), override val includes: Set<File> = 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 75e27dcc..c643fd4b 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<String> @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 623fcc2d..50ab3bad 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<ExternalDocumentationLinkImpl> = emptyList(), var sourceLinks: List<SourceLinkDefinitionImpl> = 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 dc469bba..f368ed10 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 452b821c..46916705 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<T>, 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 c0fafc25..b278ef6e 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 3632337a..c64f2fab 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<JavaRoot>) : JvmDependenciesIndex { Cache().apply { roots.indices.forEach(rootIndices::add) rootIndices.add(maxIndex) - rootIndices.trimToSize() + rootIndices.trim() } } @@ -121,8 +121,8 @@ class JvmDependenciesIndexImpl(_roots: List<JavaRoot>) : 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<JavaRoot>) : JvmDependenciesIndex { } } } |
