aboutsummaryrefslogtreecommitdiff
path: root/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt
diff options
context:
space:
mode:
authorSzymon Świstun <sswistun@virtuslab.com>2020-02-11 15:57:29 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-02-12 13:13:18 +0100
commitaf9697cbd2eb1a26c8a07d191ca6360d416a1666 (patch)
treedcb910792ba09457e7c52b64115d7215a2fa7d9b /plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt
parent50e711d24b517bc93c37d89f258c9dafaa038ad1 (diff)
downloaddokka-af9697cbd2eb1a26c8a07d191ca6360d416a1666.tar.gz
dokka-af9697cbd2eb1a26c8a07d191ca6360d416a1666.tar.bz2
dokka-af9697cbd2eb1a26c8a07d191ca6360d416a1666.zip
kotlin-as-java fixed
Diffstat (limited to 'plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt')
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt20
1 files changed, 16 insertions, 4 deletions
diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt
index 67a3ee86..8f026477 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt
@@ -3,11 +3,11 @@ package org.jetbrains.dokka.kotlinAsJava
import org.jetbrains.dokka.kotlinAsJava.conversions.asJava
import org.jetbrains.dokka.kotlinAsJava.conversions.asStatic
import org.jetbrains.dokka.kotlinAsJava.conversions.withClass
+import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.withClass
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Function
import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.doc.TagWrapper
+import org.jetbrains.dokka.model.Function
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.transformers.descriptors.KotlinClassKindTypes
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
@@ -21,8 +21,14 @@ fun <T : Documentable> List<T>.groupedByLocation(): Map<String, List<T>> =
location!!.let { it.split("/").last().split(".").first() + "Kt" }
}) { it.second }
+fun PlatformInfo.toClassPlatformInfo(inherited: List<DRI> = emptyList()) =
+ ClassPlatformInfo(this, emptyList())
+
class KotlinAsJavaPageBuilder(rootContentGroup: RootContentBuilder) : DefaultPageBuilder(rootContentGroup) {
+ override fun pageForModule(m: Module): ModulePageNode =
+ ModulePageNode(m.name.ifEmpty { "root" }, contentForModule(m), m, m.packages.map { pageForPackage(it) })
+
data class FunsAndProps(val key: String, val funs: List<Function>, val props: List<Property>)
override fun pageForPackage(p: Package): PackagePageNode {
@@ -36,6 +42,8 @@ class KotlinAsJavaPageBuilder(rootContentGroup: RootContentBuilder) : DefaultPag
val classes = (p.classlikes + zipped.map { (key, funs, props) ->
val dri = p.dri.withClass(key)
+ val actual =
+ (funs.flatMap { it.actual } + props.flatMap { it.actual }).distinct().map { it.toClassPlatformInfo() }
Class(
dri = dri,
name = key,
@@ -44,7 +52,7 @@ class KotlinAsJavaPageBuilder(rootContentGroup: RootContentBuilder) : DefaultPag
functions = funs.map { it.withClass(key, dri).asStatic() },
properties = props.map { it.withClass(key, dri) },
classlikes = emptyList(),
- actual = emptyList(),
+ actual = actual,
expected = null,
visibility = p.platformData.map { it to Visibilities.PUBLIC }.toMap()
)
@@ -64,5 +72,9 @@ class KotlinAsJavaPageBuilder(rootContentGroup: RootContentBuilder) : DefaultPag
}
}
- private fun TagWrapper.toHeaderString() = this.javaClass.toGenericString().split('.').last()
+ override fun contentForClasslike(c: Classlike): ContentGroup = when (c) {
+ is Class -> contentForClass(c)
+ is Enum -> contentForEnum(c)
+ else -> throw IllegalStateException("$c should not be present here")
+ }
} \ No newline at end of file