aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main/kotlin/org/jetbrains
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-02-24 19:27:15 +0100
committerGitHub <noreply@github.com>2023-02-24 19:27:15 +0100
commit9297e6de3446314a5d2f4639c2024d62887b109a (patch)
tree943595c57ee5c0d8da24239c526bfdb1ac54acb1 /runners/gradle-plugin/src/main/kotlin/org/jetbrains
parentb730bf43d93c60df2fc3a1b0b25485b1458a9488 (diff)
downloaddokka-9297e6de3446314a5d2f4639c2024d62887b109a.tar.gz
dokka-9297e6de3446314a5d2f4639c2024d62887b109a.tar.bz2
dokka-9297e6de3446314a5d2f4639c2024d62887b109a.zip
Fix `TypeNotPresentException` in projects without KGP (#2890)
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin/org/jetbrains')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt
index 37ec66c1..6677391b 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/utils.kt
@@ -17,8 +17,13 @@ internal fun parsePath(path: String): Path = Path.path(path)
internal val Project.kotlinOrNull: KotlinProjectExtension?
get() = try {
project.extensions.findByType()
- } catch (e: NoClassDefFoundError) {
- null
+ } catch (e: Throwable) {
+ when (e) {
+ // if the user project doesn't have KGP applied, we won't be able to load the class;
+ // TypeNotPresentException is possible if it's loaded through reified generics.
+ is NoClassDefFoundError, is TypeNotPresentException, is ClassNotFoundException -> null
+ else -> throw e
+ }
}
internal val Project.kotlin: KotlinProjectExtension