Kotlin / dokka

API documentation engine for Kotlin
https://kotl.in/dokka
Apache License 2.0
3.45k stars 408 forks source link

DokkaHtml task fails with `Collection contains no element matching the predicate` exception #3911

Open pero18 opened 1 week ago

pero18 commented 1 week ago

Describe the bug Gradle task dokkaHtml fails with the mentioned exception when trying to document an abstract property of a sealed class. Example code below.

Expected behaviour Task should succeed since the code is documented as expected.

To Reproduce Add the following code and run ./gradlew dokkaHtml

/**
 * Result
 *
 * @property info info
 */
sealed class Result {

    abstract val info: String

    /**
     * Success
     */
    data class Success(override val info: String) : Result()

    /**
     * Error
     */
    data object Error : Result() {
        override val info: String
            get() = "Error"
    }
}

The task doesn't fail when the info property is implemented as a constructor parameter of an Error class.

Dokka configuration Configuration of dokka used to reproduce the bug

    dokkaSourceSets {
        configureEach {
            documentedVisibilities.set(setOf(DokkaConfiguration.Visibility.PUBLIC))
            reportUndocumented.set(true)
            skipDeprecated.set(true)
            skipEmptyPackages.set(true)

            perPackageOptions { 
                matchingRegex.set("module-name-where-the code-is")
                suppress.set(false)
                reportUndocumented.set(true)
            }

            suppress.set(true)
        }
    }
}

Installation

whyoleg commented 4 days ago

Hey! I can't reproduce the issue with both Dokka 1.9.10 and 1.9.20. Could you please provide a reproducer via GitHub repo if possible? Or may be you do have full stack trace?