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/resolvers/local/DefaultLocationProvider.kt3
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt7
-rw-r--r--plugins/base/src/test/kotlin/basic/DRITest.kt11
-rw-r--r--plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt3
-rw-r--r--plugins/base/src/test/kotlin/enums/EnumsTest.kt3
-rw-r--r--plugins/base/src/test/kotlin/model/JavaTest.kt4
6 files changed, 17 insertions, 14 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
index 34b570a9..ba4523a1 100644
--- a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt
@@ -4,6 +4,7 @@ import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.resolvers.external.ExternalLocationProvider
import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.model.withDescendants
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
import java.net.HttpURLConnection
@@ -19,7 +20,7 @@ open class DefaultLocationProvider(
) : BaseLocationProvider(dokkaContext) {
protected open val extension = ".html"
- protected val pagesIndex: Map<DRI, ContentPage> = pageGraphRoot.asSequence().filterIsInstance<ContentPage>()
+ protected val pagesIndex: Map<DRI, ContentPage> = pageGraphRoot.withDescendants().filterIsInstance<ContentPage>()
.map { it.dri.map { dri -> dri to it } }.flatten()
.groupingBy { it.first }
.aggregate { dri, _, (_, page), first ->
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index 7c797233..76f8319d 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -33,7 +33,6 @@ import org.jetbrains.kotlin.load.java.propertyNamesBySetMethodName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.psi.psiUtil.getChildOfType
import org.jetbrains.kotlin.resolve.DescriptorUtils
-import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import java.io.File
@@ -266,9 +265,9 @@ class DefaultPsiToDocumentableTranslator(
dri.copy(target = dri.target.nextTarget()),
psiParameter.name,
DocumentationNode(
- listOfNotNull(docs.firstChildOfType<Param> {
- it.firstChildOfType<DocumentationLink>()
- ?.firstChildOfType<Text>()?.body == psiParameter.name
+ listOfNotNull(docs.firstChildOfTypeOrNull<Param> {
+ it.firstChildOfTypeOrNull<DocumentationLink>()
+ ?.firstChildOfTypeOrNull<Text>()?.body == psiParameter.name
})).toSourceSetDependent(),
null,
getBound(psiParameter.type),
diff --git a/plugins/base/src/test/kotlin/basic/DRITest.kt b/plugins/base/src/test/kotlin/basic/DRITest.kt
index b09932fe..1f4c7d93 100644
--- a/plugins/base/src/test/kotlin/basic/DRITest.kt
+++ b/plugins/base/src/test/kotlin/basic/DRITest.kt
@@ -1,11 +1,12 @@
package basic
import org.jetbrains.dokka.links.*
-import org.jetbrains.dokka.model.DClass
-import org.jetbrains.dokka.model.DFunction
-import org.jetbrains.dokka.model.DParameter
-import org.jetbrains.dokka.model.OtherParameter
+import org.jetbrains.dokka.links.Callable
+import org.jetbrains.dokka.links.Nullable
+import org.jetbrains.dokka.links.TypeConstructor
+import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.pages.*
+import org.jetbrains.dokka.pages.dfs
import org.junit.jupiter.api.Assertions.assertEquals
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
@@ -158,7 +159,7 @@ class DRITest : AbstractCoreTest() {
)
val driCount = module
- .asSequence()
+ .withDescendants()
.filterIsInstance<ContentPage>()
.sumBy { it.dri.count { dri -> dri == expectedDRI } }
diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
index 2e05d241..f6e80891 100644
--- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
+++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
@@ -3,6 +3,7 @@ package content.params
import matchers.content.*
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.model.DFunction
+import org.jetbrains.dokka.model.dfs
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.jetbrains.dokka.model.doc.Param
import org.jetbrains.dokka.model.doc.Text
@@ -607,4 +608,4 @@ class ContentForParamsTest : AbstractCoreTest() {
private fun DocumentationNode.paramsDescription(): String =
children.firstIsInstanceOrNull<Param>()?.root?.children?.firstIsInstanceOrNull<Text>()?.body.orEmpty()
-} \ No newline at end of file
+}
diff --git a/plugins/base/src/test/kotlin/enums/EnumsTest.kt b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
index dba5c24a..be910b5c 100644
--- a/plugins/base/src/test/kotlin/enums/EnumsTest.kt
+++ b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
@@ -3,6 +3,7 @@ package enums
import matchers.content.*
import org.jetbrains.dokka.model.ConstructorValues
import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.dfs
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
import org.junit.jupiter.api.Assertions.*
@@ -230,4 +231,4 @@ class EnumsTest : AbstractCoreTest() {
private fun ContentGroup.constructorSignature(): String =
(children.single() as ContentGroup).children.drop(1).joinToString(separator = "") { (it as ContentText).text }
-} \ No newline at end of file
+}
diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt
index bd7e3b55..4cad784b 100644
--- a/plugins/base/src/test/kotlin/model/JavaTest.kt
+++ b/plugins/base/src/test/kotlin/model/JavaTest.kt
@@ -34,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.firstChildOfType<Text>()?.body } equals listOf("is String parameter", "is int parameter")
+ params.mapNotNull { it.firstChildOfTypeOrNull<Text>()?.body } equals listOf("is String parameter", "is int parameter")
}
}
}
@@ -449,4 +449,4 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
// assertEquals(1, inheritors.size)
// }
// }
-} \ No newline at end of file
+}