aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src')
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt15
-rw-r--r--plugins/base/src/test/kotlin/model/JavaTest.kt5
2 files changed, 10 insertions, 10 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index 8588534b..7c797233 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -43,7 +43,7 @@ class DefaultPsiToDocumentableTranslator(
override fun invoke(sourceSet: DokkaSourceSet, context: DokkaContext): DModule {
- fun isFileInSourceRoots(file: File): Boolean {
+ fun isFileInSourceRoots(file: File) : Boolean {
return sourceSet.sourceRoots.any { root -> file.path.startsWith(File(root.path).absolutePath) }
}
@@ -256,7 +256,7 @@ class DefaultPsiToDocumentableTranslator(
inheritedFrom: DRI? = null
): DFunction {
val dri = DRI.from(psi)
- val docs = javadocParser.parseDocumentation(psi).toSourceSetDependent()
+ val docs = javadocParser.parseDocumentation(psi)
return DFunction(
dri,
if (isConstructor) "<init>" else psi.name,
@@ -265,13 +265,17 @@ class DefaultPsiToDocumentableTranslator(
DParameter(
dri.copy(target = dri.target.nextTarget()),
psiParameter.name,
- DocumentationNode(docs.entries.mapNotNull { it.value.children.filterIsInstance<Param>().firstOrNull { it.root.children.firstIsInstanceOrNull<DocumentationLink>()?.children?.firstIsInstanceOrNull<Text>()?.body == psiParameter.name } }).toSourceSetDependent(),
+ DocumentationNode(
+ listOfNotNull(docs.firstChildOfType<Param> {
+ it.firstChildOfType<DocumentationLink>()
+ ?.firstChildOfType<Text>()?.body == psiParameter.name
+ })).toSourceSetDependent(),
null,
getBound(psiParameter.type),
setOf(sourceSetData)
)
},
- docs,
+ docs.toSourceSetDependent(),
null,
PsiDocumentableSource(psi).toSourceSetDependent(),
psi.getVisibility().toSourceSetDependent(),
@@ -301,7 +305,6 @@ class DefaultPsiToDocumentableTranslator(
ExtraModifiers.JavaOnlyModifiers.Transitive.takeIf { hasModifier(JvmModifier.TRANSITIVE) }
).toSet()
-
private fun Set<ExtraModifiers>.toListOfAnnotations() = map {
if (it !is ExtraModifiers.JavaOnlyModifiers.Static)
Annotations.Annotation(DRI("kotlin.jvm", it.name.toLowerCase().capitalize()), emptyMap())
@@ -394,7 +397,7 @@ class DefaultPsiToDocumentableTranslator(
val dri = DRI.from(psi)
return DProperty(
dri,
- psi.name!!, // TODO: Investigate if this is indeed nullable
+ psi.name,
javadocParser.parseDocumentation(psi).toSourceSetDependent(),
null,
PsiDocumentableSource(psi).toSourceSetDependent(),
diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt
index aefcc642..bd7e3b55 100644
--- a/plugins/base/src/test/kotlin/model/JavaTest.kt
+++ b/plugins/base/src/test/kotlin/model/JavaTest.kt
@@ -6,13 +6,10 @@ import org.jetbrains.dokka.links.sureClassNames
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.doc.Param
import org.jetbrains.dokka.model.doc.Text
-import org.jetbrains.dokka.pages.dfs
-import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import utils.AbstractModelTest
import utils.assertNotNull
-import utils.docs
import utils.name
class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
@@ -37,7 +34,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
with((this / "fn").cast<DFunction>()) {
name equals "fn"
val params = parameters.map { it.documentation.values.first().children.first() as Param }
- params.mapNotNull { it.root.children.firstIsInstanceOrNull<Text>()?.body } equals listOf("is String parameter", "is int parameter")
+ params.mapNotNull { it.firstChildOfType<Text>()?.body } equals listOf("is String parameter", "is int parameter")
}
}
}