aboutsummaryrefslogtreecommitdiff
path: root/subprojects
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2023-10-24 18:12:46 +0300
committerGitHub <noreply@github.com>2023-10-24 18:12:46 +0300
commitb28120111d98cc9ce70f31266cc81a9ae85015f9 (patch)
treefba3682e241d87e293789d5463a80e71c90f5ef1 /subprojects
parent21c587bc2e3904d370ca28e7404122bbad49ecf8 (diff)
downloaddokka-b28120111d98cc9ce70f31266cc81a9ae85015f9.tar.gz
dokka-b28120111d98cc9ce70f31266cc81a9ae85015f9.tar.bz2
dokka-b28120111d98cc9ce70f31266cc81a9ae85015f9.zip
Make using of the compiler single-thread (#3202)
Diffstat (limited to 'subprojects')
-rw-r--r--subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/translator/DefaultDescriptorToDocumentableTranslator.kt17
1 files changed, 10 insertions, 7 deletions
diff --git a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/translator/DefaultDescriptorToDocumentableTranslator.kt b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/translator/DefaultDescriptorToDocumentableTranslator.kt
index 02e9545b..f20514cf 100644
--- a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/translator/DefaultDescriptorToDocumentableTranslator.kt
+++ b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/translator/DefaultDescriptorToDocumentableTranslator.kt
@@ -7,10 +7,7 @@ package org.jetbrains.dokka.analysis.kotlin.descriptors.compiler.translator
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiNamedElement
import com.intellij.psi.util.PsiLiteralUtil.*
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.async
-import kotlinx.coroutines.coroutineScope
-import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.*
import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.analysis.java.JavaAnalysisPlugin
import org.jetbrains.dokka.analysis.java.parsers.JavadocParser
@@ -124,6 +121,10 @@ internal class DefaultDescriptorToDocumentableTranslator(
}
}
+ /**
+ * Implementation note: it runs in a separated single thread due to existing support of coroutines (see #2936)
+ */
+ @OptIn(DelicateCoroutinesApi::class)
override fun translateClassDescriptor(descriptor: ClassDescriptor, sourceSet: DokkaSourceSet): DClasslike {
val driInfo = DRI.from(descriptor.parents.first()).withEmptyInfo()
@@ -132,9 +133,11 @@ internal class DefaultDescriptorToDocumentableTranslator(
docCommentFinder = context.plugin<JavaAnalysisPlugin>().docCommentFinder
)
- return runBlocking(Dispatchers.Default) {
- DokkaDescriptorVisitor(sourceSet, kdocFinder, kotlinAnalysis[sourceSet], context.logger, javadocParser)
- .visitClassDescriptor(descriptor, driInfo)
+ return newSingleThreadContext("Generating documentable model of classlike").use { coroutineContext -> // see https://github.com/Kotlin/dokka/issues/3151
+ runBlocking(coroutineContext) {
+ DokkaDescriptorVisitor(sourceSet, kdocFinder, kotlinAnalysis[sourceSet], context.logger, javadocParser)
+ .visitClassDescriptor(descriptor, driInfo)
+ }
}
}
}