aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/javadoc/src')
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt11
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt7
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt4
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt2
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocDeprecatedTest.kt3
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt3
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt2
7 files changed, 24 insertions, 8 deletions
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt
index 61d45ae1..a79c6b20 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt
@@ -37,9 +37,12 @@ open class JavadocPageCreator(context: DokkaContext) {
p.classlikes.mapNotNull { pageForClasslike(it) }
)
- fun pageForClasslike(c: DClasslike): JavadocClasslikePageNode? =
- c.highestJvmSourceSet?.let { jvm ->
+ fun pageForClasslike(c: DClasslike): JavadocClasslikePageNode? {
+ return c.highestJvmSourceSet?.let { jvm ->
+ @Suppress("UNCHECKED_CAST")
+ val extra = ((c as? WithExtraProperties<Documentable>)?.extra ?: PropertyContainer.empty())
val children = c.classlikes.mapNotNull { pageForClasslike(it) }
+
JavadocClasslikePageNode(
name = c.dri.classNames.orEmpty(),
content = contentForClasslike(c),
@@ -70,10 +73,10 @@ open class JavadocPageCreator(context: DokkaContext) {
},
documentables = listOf(c),
children = children,
- extra = ((c as? WithExtraProperties<Documentable>)?.extra
- ?: PropertyContainer.empty()) + c.indexesInDocumentation()
+ extra = extra + c.indexesInDocumentation()
)
}
+ }
private fun contentForModule(m: DModule): JavadocContentNode =
JavadocContentGroup(
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
index bef4108c..057b9e85 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
@@ -39,12 +39,13 @@ object TreeViewInstaller : PageTransformer {
root = root
)
- return node.modified(children = node.children.map { node ->
+ val nodeChildren = node.children.map { childNode ->
install(
- node,
+ childNode,
root
)
- } + overviewTree) as JavadocModulePageNode
+ }
+ return node.modified(children = nodeChildren + overviewTree) as JavadocModulePageNode
}
private fun installPackageTreeNode(node: JavadocPackagePageNode, root: RootPageNode): JavadocPackagePageNode {
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt
index 1d721611..f8377e41 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt
@@ -11,7 +11,6 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.renderers.OutputWriter
-import org.jetbrains.dokka.base.resolvers.local.LocationProvider
import org.jetbrains.dokka.javadoc.JavadocPlugin
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.pages.*
@@ -136,7 +135,9 @@ class KorteJavadocRenderer(val context: DokkaContext, resourceDir: String) :
)
},
TeFunction("createPackageHierarchy") { args ->
+ @Suppress("UNCHECKED_CAST")
val list = args.first() as List<JavadocPackagePageNode>
+
list.mapIndexed { i, p ->
val content = if (i + 1 == list.size) "" else ", "
val name = p.name
@@ -144,6 +145,7 @@ class KorteJavadocRenderer(val context: DokkaContext, resourceDir: String) :
}.joinToString("\n")
},
TeFunction("renderInheritanceGraph") { args ->
+ @Suppress("UNCHECKED_CAST")
val rootNodes = args.first() as List<TreeViewPage.InheritanceNode>
fun drawRec(node: TreeViewPage.InheritanceNode): String =
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt
index 10240a3f..0f8d7e79 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocClasslikeTemplateMapTest.kt
@@ -351,8 +351,10 @@ internal class JavadocClasslikeTemplateMapTest : AbstractJavadocTemplateMapTest(
private fun Map<String, Any?>.signatureWithModifiers(): String = "${modifiers()} ${signatureWithoutModifiers()}"
+ @Suppress("UNCHECKED_CAST")
private fun Map<String, Any?>.signatureWithoutModifiers(): String = (get("signature") as Map<String, Any?>)["signatureWithoutModifiers"] as String
+ @Suppress("UNCHECKED_CAST")
private fun Map<String, Any?>.modifiers(): String = (get("signature") as Map<String, Any?>)["modifiers"] as String
}
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocDeprecatedTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocDeprecatedTest.kt
index 982d356a..e2331f58 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocDeprecatedTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocDeprecatedTest.kt
@@ -10,6 +10,7 @@ internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() {
@Test
fun `generates correct number of sections`() {
testDeprecatedPageTemplateMaps { templateMap ->
+ @Suppress("UNCHECKED_CAST")
Assertions.assertEquals(6, (templateMap["sections"] as List<TemplateMap>).size)
}
}
@@ -164,9 +165,11 @@ internal class JavadocDeprecatedTest : AbstractJavadocTemplateMapTest() {
operation(firstPageOfType<DeprecatedPage>().templateMap)
}
+ @Suppress("UNCHECKED_CAST")
private fun TemplateMap.section(name: String) =
(this["sections"] as List<TemplateMap>).first { it["caption"] == name }
+ @Suppress("UNCHECKED_CAST")
private fun TemplateMap.elements() =
this["elements"] as List<TemplateMap>
} \ No newline at end of file
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt
index 801213c2..76c345b0 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocIndexTest.kt
@@ -28,6 +28,7 @@ internal class JavadocIndexTest : AbstractJavadocTemplateMapTest() {
@Test
fun `templateMap for class index`() {
testIndexPagesTemplateMaps { templateMaps ->
+ @Suppress("UNCHECKED_CAST")
val element = (templateMaps[2]["elements"] as List<TemplateMap>)[1]
assertEquals("../package0/ClassA.html", element["address"])
assertEquals("ClassA", element["name"])
@@ -41,6 +42,7 @@ internal class JavadocIndexTest : AbstractJavadocTemplateMapTest() {
@Test
fun `templateMap for enum entry index`() {
testIndexPagesTemplateMaps { templateMaps ->
+ @Suppress("UNCHECKED_CAST")
val element = (templateMaps[0]["elements"] as List<TemplateMap>).last()
assertEquals("../package1/ClassCEnum.html#A", element["address"])
assertEquals("A", element["name"])
@@ -54,6 +56,7 @@ internal class JavadocIndexTest : AbstractJavadocTemplateMapTest() {
@Test
fun `templateMap for function index`() {
testIndexPagesTemplateMaps { templateMaps ->
+ @Suppress("UNCHECKED_CAST")
val element = (templateMaps[0]["elements"] as List<TemplateMap>).first()
assertEquals("../package0/ClassA.html#a()", element["address"])
assertEquals("a()", element["name"])
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt
index 356e5772..592d7b0d 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocPackageTemplateMapTest.kt
@@ -13,6 +13,7 @@ import java.io.File
internal class JavadocPackageTemplateMapTest : AbstractJavadocTemplateMapTest() {
@Test
+ @Suppress("UNCHECKED_CAST")
fun `single class`() {
dualTestTemplateMapInline(
kotlin =
@@ -44,6 +45,7 @@ internal class JavadocPackageTemplateMapTest : AbstractJavadocTemplateMapTest()
}
@Test
+ @Suppress("UNCHECKED_CAST")
fun `multiple packages`() {
dualTestTemplateMapInline(
kotlin =