blob: ae295769ff7eb23451f57ee3599df6089dffa485 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package org.jetbrains.dokka
import com.intellij.openapi.project.Project
import com.intellij.psi.JavaPsiFacade
import org.jetbrains.kotlin.asJava.KotlinLightElement
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.name.FqName
class KotlinAsJavaDocumentationBuilder() : PackageDocumentationBuilder {
override fun buildPackageDocumentation(project: Project,
packageName: FqName,
packageNode: DocumentationNode,
declarations: List<DeclarationDescriptor>,
options: DocumentationOptions,
refGraph: NodeReferenceGraph,
logger: DokkaLogger) {
val psiPackage = JavaPsiFacade.getInstance(project).findPackage(packageName.asString())
if (psiPackage == null) {
logger.error("Cannot find Java package by qualified name: ${packageName.asString()}")
return
}
val javaDocumentationBuilder = JavaDocumentationBuilder(options, refGraph)
psiPackage.classes.filter { it is KotlinLightElement<*, *> }.forEach {
javaDocumentationBuilder.appendClasses(packageNode, arrayOf(it))
}
}
}
|