aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/Kotlin/KotlinAsJavaDocumentationBuilder.kt')
-rw-r--r--src/Kotlin/KotlinAsJavaDocumentationBuilder.kt17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt b/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt
index 8c6e5701..3d3f0b00 100644
--- a/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt
+++ b/src/Kotlin/KotlinAsJavaDocumentationBuilder.kt
@@ -1,14 +1,18 @@
package org.jetbrains.dokka
+import com.google.inject.Inject
import com.intellij.psi.JavaPsiFacade
import com.intellij.psi.PsiNamedElement
+import org.jetbrains.dokka.Kotlin.DescriptorDocumentationParser
import org.jetbrains.kotlin.asJava.KotlinLightElement
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtParameter
import org.jetbrains.kotlin.psi.KtPropertyAccessor
-class KotlinAsJavaDocumentationBuilder() : PackageDocumentationBuilder {
+class KotlinAsJavaDocumentationBuilder
+ @Inject constructor(val kotlinAsJavaDocumentationParser: KotlinAsJavaDocumentationParser) : PackageDocumentationBuilder
+{
override fun buildPackageDocumentation(documentationBuilder: DocumentationBuilder,
packageName: FqName,
packageNode: DocumentationNode,
@@ -22,7 +26,7 @@ class KotlinAsJavaDocumentationBuilder() : PackageDocumentationBuilder {
val javaDocumentationBuilder = JavaPsiDocumentationBuilder(documentationBuilder.options,
documentationBuilder.refGraph,
- KotlinAsJavaDocumentationParser(documentationBuilder))
+ kotlinAsJavaDocumentationParser)
psiPackage.classes.filter { it is KotlinLightElement<*, *> }.forEach {
javaDocumentationBuilder.appendClasses(packageNode, arrayOf(it))
@@ -30,7 +34,10 @@ class KotlinAsJavaDocumentationBuilder() : PackageDocumentationBuilder {
}
}
-class KotlinAsJavaDocumentationParser(val documentationBuilder: DocumentationBuilder) : JavaDocumentationParser {
+class KotlinAsJavaDocumentationParser
+ @Inject constructor(val resolutionFacade: DokkaResolutionFacade,
+ val descriptorDocumentationParser: DescriptorDocumentationParser) : JavaDocumentationParser
+{
override fun parseDocumentation(element: PsiNamedElement): JavadocParseResult {
val kotlinLightElement = element as? KotlinLightElement<*, *> ?: return JavadocParseResult.Empty
val origin = kotlinLightElement.getOrigin() ?: return JavadocParseResult.Empty
@@ -41,8 +48,8 @@ class KotlinAsJavaDocumentationParser(val documentationBuilder: DocumentationBui
return JavadocParseResult.Empty
}
}
- val descriptor = documentationBuilder.resolutionFacade.resolveToDescriptor(origin)
- val content = documentationBuilder.parseDocumentation(descriptor)
+ val descriptor = resolutionFacade.resolveToDescriptor(origin)
+ val content = descriptorDocumentationParser.parseDocumentation(descriptor)
return JavadocParseResult(content, null)
}
}