aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/javadoc')
-rw-r--r--plugins/javadoc/api/javadoc.api25
-rw-r--r--plugins/javadoc/build.gradle.kts8
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt8
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt102
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt14
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt7
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt24
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt7
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt2
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/translators/documentables/JavadocPageContentBuilder.kt5
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/AbstractJavadocTemplateMapTest.kt10
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/Asserts.kt3
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAccessorNamingTest.kt6
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLinkingTest.kt2
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt12
-rw-r--r--plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt2
16 files changed, 75 insertions, 162 deletions
diff --git a/plugins/javadoc/api/javadoc.api b/plugins/javadoc/api/javadoc.api
index 4d077882..66475972 100644
--- a/plugins/javadoc/api/javadoc.api
+++ b/plugins/javadoc/api/javadoc.api
@@ -583,13 +583,13 @@ public final class org/jetbrains/dokka/javadoc/pages/TitleNode : org/jetbrains/d
}
public final class org/jetbrains/dokka/javadoc/pages/TreeViewInstaller : org/jetbrains/dokka/transformers/pages/PageTransformer {
- public static final field INSTANCE Lorg/jetbrains/dokka/javadoc/pages/TreeViewInstaller;
+ public fun <init> (Lorg/jetbrains/dokka/plugability/DokkaContext;)V
public fun invoke (Lorg/jetbrains/dokka/pages/RootPageNode;)Lorg/jetbrains/dokka/pages/RootPageNode;
}
public final class org/jetbrains/dokka/javadoc/pages/TreeViewPage : org/jetbrains/dokka/javadoc/pages/JavadocPageNode {
- public fun <init> (Ljava/lang/String;Ljava/util/List;Ljava/util/List;Ljava/util/Set;Ljava/util/List;Lorg/jetbrains/dokka/pages/PageNode;)V
- public synthetic fun <init> (Ljava/lang/String;Ljava/util/List;Ljava/util/List;Ljava/util/Set;Ljava/util/List;Lorg/jetbrains/dokka/pages/PageNode;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
+ public fun <init> (Ljava/lang/String;Ljava/util/List;Ljava/util/List;Ljava/util/Set;Ljava/util/List;Lorg/jetbrains/dokka/pages/PageNode;Lorg/jetbrains/kotlin/analysis/kotlin/internal/InheritanceBuilder;)V
+ public synthetic fun <init> (Ljava/lang/String;Ljava/util/List;Ljava/util/List;Ljava/util/Set;Ljava/util/List;Lorg/jetbrains/dokka/pages/PageNode;Lorg/jetbrains/kotlin/analysis/kotlin/internal/InheritanceBuilder;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun getChildren ()Ljava/util/List;
public final fun getClasses ()Ljava/util/List;
public fun getContent ()Lorg/jetbrains/dokka/pages/ContentNode;
@@ -597,6 +597,7 @@ public final class org/jetbrains/dokka/javadoc/pages/TreeViewPage : org/jetbrain
public fun getDocumentables ()Ljava/util/List;
public fun getDri ()Ljava/util/Set;
public fun getEmbeddedResources ()Ljava/util/List;
+ public final fun getInheritanceBuilder ()Lorg/jetbrains/kotlin/analysis/kotlin/internal/InheritanceBuilder;
public final fun getKind ()Ljava/lang/String;
public fun getName ()Ljava/lang/String;
public final fun getPackages ()Ljava/util/List;
@@ -606,24 +607,6 @@ public final class org/jetbrains/dokka/javadoc/pages/TreeViewPage : org/jetbrain
public fun modified (Ljava/lang/String;Lorg/jetbrains/dokka/pages/ContentNode;Ljava/util/Set;Ljava/util/List;Ljava/util/List;)Lorg/jetbrains/dokka/pages/ContentPage;
}
-public final class org/jetbrains/dokka/javadoc/pages/TreeViewPage$InheritanceNode {
- public fun <init> (Lorg/jetbrains/dokka/links/DRI;Ljava/util/List;Ljava/util/List;Z)V
- public synthetic fun <init> (Lorg/jetbrains/dokka/links/DRI;Ljava/util/List;Ljava/util/List;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
- public final fun component1 ()Lorg/jetbrains/dokka/links/DRI;
- public final fun component2 ()Ljava/util/List;
- public final fun component3 ()Ljava/util/List;
- public final fun component4 ()Z
- public final fun copy (Lorg/jetbrains/dokka/links/DRI;Ljava/util/List;Ljava/util/List;Z)Lorg/jetbrains/dokka/javadoc/pages/TreeViewPage$InheritanceNode;
- public static synthetic fun copy$default (Lorg/jetbrains/dokka/javadoc/pages/TreeViewPage$InheritanceNode;Lorg/jetbrains/dokka/links/DRI;Ljava/util/List;Ljava/util/List;ZILjava/lang/Object;)Lorg/jetbrains/dokka/javadoc/pages/TreeViewPage$InheritanceNode;
- public fun equals (Ljava/lang/Object;)Z
- public final fun getChildren ()Ljava/util/List;
- public final fun getDri ()Lorg/jetbrains/dokka/links/DRI;
- public final fun getInterfaces ()Ljava/util/List;
- public fun hashCode ()I
- public final fun isInterface ()Z
- public fun toString ()Ljava/lang/String;
-}
-
public abstract interface class org/jetbrains/dokka/javadoc/pages/WithBrief {
public abstract fun getBrief ()Ljava/util/List;
}
diff --git a/plugins/javadoc/build.gradle.kts b/plugins/javadoc/build.gradle.kts
index 462e966f..5c6d2eb6 100644
--- a/plugins/javadoc/build.gradle.kts
+++ b/plugins/javadoc/build.gradle.kts
@@ -7,21 +7,19 @@ plugins {
dependencies {
compileOnly(projects.core)
- compileOnly(projects.kotlinAnalysis)
+ compileOnly(projects.subprojects.analysisKotlinApi)
- implementation(kotlin("reflect"))
- implementation(libs.soywiz.korte)
implementation(projects.plugins.base)
implementation(projects.plugins.kotlinAsJava)
+ implementation(kotlin("reflect"))
+ implementation(libs.soywiz.korte)
implementation(libs.kotlinx.html)
implementation(libs.kotlinx.coroutines.core)
testImplementation(projects.plugins.base.baseTestUtils)
testImplementation(projects.core.testApi)
-
testImplementation(libs.jsoup)
-
testImplementation(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter)
}
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt
index 50355c7e..70362ad4 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPlugin.kt
@@ -1,15 +1,15 @@
package org.jetbrains.dokka.javadoc
-import org.jetbrains.dokka.javadoc.location.JavadocLocationProviderFactory
-import org.jetbrains.dokka.javadoc.renderer.KorteJavadocRenderer
-import org.jetbrains.dokka.javadoc.signatures.JavadocSignatureProvider
import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.renderers.PackageListCreator
import org.jetbrains.dokka.base.renderers.RootCreator
import org.jetbrains.dokka.base.resolvers.shared.PackageList.Companion.PACKAGE_LIST_NAME
import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat
+import org.jetbrains.dokka.javadoc.location.JavadocLocationProviderFactory
import org.jetbrains.dokka.javadoc.pages.*
+import org.jetbrains.dokka.javadoc.renderer.KorteJavadocRenderer
+import org.jetbrains.dokka.javadoc.signatures.JavadocSignatureProvider
import org.jetbrains.dokka.javadoc.transformers.documentables.JavadocDocumentableJVMSourceSetFilter
import org.jetbrains.dokka.javadoc.validity.MultiplatformConfiguredChecker
import org.jetbrains.dokka.kotlinAsJava.KotlinAsJavaPlugin
@@ -70,7 +70,7 @@ class JavadocPlugin : DokkaPlugin() {
}
val treeViewInstaller by extending {
- javadocPreprocessors with TreeViewInstaller order { after(rootCreator) }
+ javadocPreprocessors providing ::TreeViewInstaller order { after(rootCreator) }
}
val allClassessPageInstaller by extending {
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt
index 8210b30a..083b5c9a 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt
@@ -1,19 +1,14 @@
package org.jetbrains.dokka.javadoc.pages
-import com.intellij.psi.PsiClass
import org.jetbrains.dokka.Platform
-import org.jetbrains.dokka.analysis.DescriptorDocumentableSource
-import org.jetbrains.dokka.analysis.PsiDocumentableSource
-import org.jetbrains.dokka.analysis.from
import org.jetbrains.dokka.base.renderers.sourceSets
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.jetbrains.dokka.pages.*
-import org.jetbrains.kotlin.descriptors.ClassDescriptor
-import org.jetbrains.kotlin.descriptors.ClassKind
-import org.jetbrains.kotlin.resolve.DescriptorUtils.getClassDescriptorForType
+import org.jetbrains.kotlin.analysis.kotlin.internal.InheritanceBuilder
+import org.jetbrains.kotlin.analysis.kotlin.internal.InheritanceNode
interface JavadocPageNode : ContentPage, WithDocumentables
@@ -386,7 +381,8 @@ class TreeViewPage(
val classes: List<JavadocClasslikePageNode>?,
override val dri: Set<DRI>,
override val documentables: List<Documentable> = emptyList(),
- val root: PageNode
+ val root: PageNode,
+ val inheritanceBuilder: InheritanceBuilder
) : JavadocPageNode {
init {
assert(packages == null || classes == null)
@@ -397,7 +393,6 @@ class TreeViewPage(
getDocumentableEntries(node)
}.groupBy({ it.first }) { it.second }.map { (l, r) -> l to r.first() }.toMap()
- private val descriptorMap = getDescriptorMap()
private val inheritanceTuple = generateInheritanceTree()
internal val classGraph = inheritanceTuple.first
internal val interfaceGraph = inheritanceTuple.second
@@ -427,7 +422,8 @@ class TreeViewPage(
classes = children.filterIsInstance<JavadocClasslikePageNode>().takeIf { it.isNotEmpty() },
dri = dri,
documentables,
- root = root
+ root = root,
+ inheritanceBuilder
)
override fun modified(name: String, children: List<PageNode>): PageNode =
@@ -437,7 +433,8 @@ class TreeViewPage(
classes = children.filterIsInstance<JavadocClasslikePageNode>().takeIf { it.isNotEmpty() },
dri = dri,
documentables,
- root = root
+ root = root,
+ inheritanceBuilder
)
override val embeddedResources: List<String> = emptyList()
@@ -484,51 +481,8 @@ class TreeViewPage(
fun interfaceTree(node: InheritanceNode) = interfaceTreeRec(node).firstOrNull() // TODO.single()
- fun gatherPsiClasses(psi: PsiClass): List<Pair<PsiClass, List<PsiClass>>> = psi.supers.toList().let { l ->
- listOf(psi to l) + l.flatMap { gatherPsiClasses(it) }
- }
-
- val psiInheritanceTree =
- childrenDocumentables.flatMap { (_, v) -> (v as? WithSources)?.sources?.values.orEmpty() }
- .filterIsInstance<PsiDocumentableSource>().mapNotNull { it.psi as? PsiClass }
- .flatMap(::gatherPsiClasses)
- .flatMap { entry -> entry.second.map { it to entry.first } }
- .let {
- it + it.map { it.second to null }
- }
- .groupBy({ it.first }) { it.second }
- .map { it.key to it.value.filterNotNull().distinct() }
- .map { (k, v) ->
- InheritanceNode(
- DRI.from(k),
- v.map { InheritanceNode(DRI.from(it)) },
- k.supers.filter { it.isInterface }.map { DRI.from(it) },
- k.isInterface
- )
-
- }
-
- val descriptorInheritanceTree = descriptorMap.flatMap { (_, v) ->
- v.typeConstructor.supertypes
- .map { getClassDescriptorForType(it) to v }
- }
- .let {
- it + it.map { it.second to null }
- }
- .groupBy({ it.first }) { it.second }
- .map { it.key to it.value.filterNotNull().distinct() }
- .map { (k, v) ->
- InheritanceNode(
- DRI.from(k),
- v.map { InheritanceNode(DRI.from(it)) },
- k.typeConstructor.supertypes.map { getClassDescriptorForType(it) }
- .mapNotNull { cd -> cd.takeIf { it.kind == ClassKind.INTERFACE }?.let { DRI.from(it) } },
- isInterface = k.kind == ClassKind.INTERFACE
- )
- }
-
- descriptorInheritanceTree.forEach { addToMap(it, mergeMap) }
- psiInheritanceTree.forEach { addToMap(it, mergeMap) }
+ val inheritanceNodes = inheritanceBuilder.build(childrenDocumentables)
+ inheritanceNodes.forEach { addToMap(it, mergeMap) }
val rootNodes = mergeMap.entries.filter {
it.key.classNames in setOf("Any", "Object") //TODO: Probably should be matched by DRI, not just className
@@ -539,47 +493,11 @@ class TreeViewPage(
return rootNodes.let { Pair(it.mapNotNull(::classTree), it.mapNotNull(::interfaceTree)) }
}
- private fun generateInterfaceGraph() {
- childrenDocumentables.values.filterIsInstance<DInterface>()
- }
-
private fun getDocumentableEntries(node: WithDocumentables): List<Pair<DRI, Documentable>> =
node.documentables.map { it.dri to it } +
(node as? ContentPage)?.children?.filterIsInstance<WithDocumentables>()
?.flatMap(::getDocumentableEntries).orEmpty()
- private fun getDescriptorMap(): Map<DRI, ClassDescriptor> {
- val map: MutableMap<DRI, ClassDescriptor> = mutableMapOf()
- childrenDocumentables
- .mapNotNull { (k, v) ->
- v.descriptorForPlatform()?.let { k to it }?.also { (k, v) -> map[k] = v }
- }.map { it.second }.forEach { gatherSupertypes(it, map) }
-
- return map.toMap()
- }
-
- private fun gatherSupertypes(descriptor: ClassDescriptor, map: MutableMap<DRI, ClassDescriptor>) {
- map.putIfAbsent(DRI.from(descriptor), descriptor)
- descriptor.typeConstructor.supertypes.map { getClassDescriptorForType(it) }
- .forEach { gatherSupertypes(it, map) }
- }
-
- private fun Documentable?.descriptorForPlatform(platform: Platform = Platform.jvm) =
- (this as? WithSources).descriptorForPlatform(platform)
-
- private fun WithSources?.descriptorForPlatform(platform: Platform = Platform.jvm) = this?.let {
- it.sources.entries.find { it.key.analysisPlatform == platform }?.value?.let { it as? DescriptorDocumentableSource }?.descriptor as? ClassDescriptor
- }
-
- data class InheritanceNode(
- val dri: DRI,
- val children: List<InheritanceNode> = emptyList(),
- val interfaces: List<DRI> = emptyList(),
- val isInterface: Boolean = false
- ) {
- override fun equals(other: Any?): Boolean = other is InheritanceNode && other.dri == dri
- override fun hashCode(): Int = dri.hashCode()
- }
}
private fun Documentable.kind(): String? =
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 e6e0e037..db6845a5 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
@@ -8,7 +8,11 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.BooleanValue
import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.pages.*
+import org.jetbrains.dokka.plugability.DokkaContext
+import org.jetbrains.dokka.plugability.plugin
+import org.jetbrains.dokka.plugability.querySingle
import org.jetbrains.dokka.transformers.pages.PageTransformer
+import org.jetbrains.kotlin.analysis.kotlin.internal.InternalKotlinAnalysisPlugin
object ResourcesInstaller : PageTransformer {
override fun invoke(input: RootPageNode): RootPageNode = input.modified(
@@ -21,7 +25,7 @@ object ResourcesInstaller : PageTransformer {
)
}
-object TreeViewInstaller : PageTransformer {
+class TreeViewInstaller(private val context: DokkaContext) : PageTransformer {
override fun invoke(input: RootPageNode): RootPageNode = install(input, input) as RootPageNode
private fun install(node: PageNode, root: RootPageNode): PageNode = when (node) {
@@ -37,7 +41,8 @@ object TreeViewInstaller : PageTransformer {
classes = null,
dri = node.dri,
documentables = node.documentables,
- root = root
+ root = root,
+ inheritanceBuilder = context.plugin<InternalKotlinAnalysisPlugin>().querySingle { inheritanceBuilder }
)
val nodeChildren = node.children.map { childNode ->
@@ -56,7 +61,8 @@ object TreeViewInstaller : PageTransformer {
classes = node.children.filterIsInstance<JavadocClasslikePageNode>(),
dri = node.dri,
documentables = node.documentables,
- root = root
+ root = root,
+ inheritanceBuilder = context.plugin<InternalKotlinAnalysisPlugin>().querySingle { inheritanceBuilder }
)
return node.modified(children = node.children + packageTree) as JavadocPackagePageNode
@@ -180,4 +186,4 @@ object DeprecatedPageCreator : PageTransformer {
)
)
}
-} \ No newline at end of file
+}
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt
index 6a590bc7..f345e32b 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/JavadocContentToTemplateMapTranslator.kt
@@ -1,16 +1,17 @@
package org.jetbrains.dokka.javadoc.renderer
+import org.jetbrains.dokka.Platform
+import org.jetbrains.dokka.base.renderers.sourceSets
import org.jetbrains.dokka.javadoc.location.JavadocLocationProvider
import org.jetbrains.dokka.javadoc.pages.*
import org.jetbrains.dokka.javadoc.toNormalized
-import org.jetbrains.dokka.Platform
-import org.jetbrains.dokka.base.renderers.sourceSets
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.parent
import org.jetbrains.dokka.links.sureClassNames
import org.jetbrains.dokka.model.ImplementedInterfaces
import org.jetbrains.dokka.model.InheritedMember
-import org.jetbrains.dokka.pages.*
+import org.jetbrains.dokka.pages.ContentNode
+import org.jetbrains.dokka.pages.PageNode
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.utilities.formatToEndWithHtml
import java.io.File
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 f50ae124..aecd85f7 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
@@ -1,10 +1,6 @@
package org.jetbrains.dokka.javadoc.renderer
import com.soywiz.korte.*
-import org.jetbrains.dokka.javadoc.location.JavadocLocationProvider
-import org.jetbrains.dokka.javadoc.pages.*
-import org.jetbrains.dokka.javadoc.renderer.JavadocContentToHtmlTranslator.Companion.buildLink
-import org.jetbrains.dokka.javadoc.toNormalized
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -12,14 +8,21 @@ import kotlinx.coroutines.runBlocking
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.renderers.OutputWriter
import org.jetbrains.dokka.javadoc.JavadocPlugin
+import org.jetbrains.dokka.javadoc.location.JavadocLocationProvider
+import org.jetbrains.dokka.javadoc.pages.*
+import org.jetbrains.dokka.javadoc.renderer.JavadocContentToHtmlTranslator.Companion.buildLink
+import org.jetbrains.dokka.javadoc.toNormalized
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.pages.*
+import org.jetbrains.dokka.pages.PageNode
+import org.jetbrains.dokka.pages.RendererSpecificPage
+import org.jetbrains.dokka.pages.RenderingStrategy
+import org.jetbrains.dokka.pages.RootPageNode
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.plugin
import org.jetbrains.dokka.plugability.query
import org.jetbrains.dokka.plugability.querySingle
import org.jetbrains.dokka.renderers.Renderer
-import org.jetbrains.kotlin.utils.addToStdlib.safeAs
+import org.jetbrains.kotlin.analysis.kotlin.internal.InheritanceNode
import java.time.LocalDate
typealias TemplateMap = Map<String, Any?>
@@ -146,9 +149,9 @@ class KorteJavadocRenderer(val context: DokkaContext, resourceDir: String) :
},
TeFunction("renderInheritanceGraph") { args ->
@Suppress("UNCHECKED_CAST")
- val rootNodes = args.first() as List<TreeViewPage.InheritanceNode>
+ val rootNodes = args.first() as List<InheritanceNode>
- fun drawRec(node: TreeViewPage.InheritanceNode): String =
+ fun drawRec(node: InheritanceNode): String =
"<li class=\"circle\">" + node.dri.let { dri ->
listOfNotNull(
dri.packageName,
@@ -170,8 +173,9 @@ class KorteJavadocRenderer(val context: DokkaContext, resourceDir: String) :
},
Filter("length") { subject.dynamicLength() },
TeFunction("hasAnyDescription") { args ->
- args.first().safeAs<List<HashMap<String, String>>>()
- ?.any { it["description"]?.trim()?.isNotEmpty() ?: false }
+ @Suppress("UNCHECKED_CAST")
+ val map = args.first() as? List<HashMap<String, String>>
+ map?.any { it["description"]?.trim()?.isNotEmpty() ?: false }
}
).forEach {
when (it) {
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt
index 6c2fed58..a7a01fc1 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt
@@ -1,16 +1,15 @@
package org.jetbrains.dokka.javadoc.renderer
-import org.jetbrains.dokka.javadoc.pages.*
-import org.jetbrains.dokka.javadoc.renderer.SearchRecord.Companion.allTypes
import org.jetbrains.dokka.base.renderers.sourceSets
-import org.jetbrains.dokka.base.resolvers.local.resolveOrThrow
import org.jetbrains.dokka.base.resolvers.local.LocationProvider
+import org.jetbrains.dokka.base.resolvers.local.resolveOrThrow
+import org.jetbrains.dokka.javadoc.pages.*
+import org.jetbrains.dokka.javadoc.renderer.SearchRecord.Companion.allTypes
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.DisplaySourceSet
import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.utilities.formatToEndWithHtml
-import java.lang.StringBuilder
class SearchScriptsCreator(private val locationProvider: LocationProvider) {
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt
index 385e0986..f81b8c5c 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/signatures/JavadocSignatureProvider.kt
@@ -1,12 +1,12 @@
package org.jetbrains.dokka.javadoc.signatures
-import org.jetbrains.dokka.javadoc.translators.documentables.JavadocPageContentBuilder
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.signatures.JvmSignatureUtils
import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
+import org.jetbrains.dokka.javadoc.translators.documentables.JavadocPageContentBuilder
import org.jetbrains.dokka.kotlinAsJava.signatures.JavaSignatureUtils
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.sureClassNames
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/translators/documentables/JavadocPageContentBuilder.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/translators/documentables/JavadocPageContentBuilder.kt
index e70f8370..68faba5f 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/translators/documentables/JavadocPageContentBuilder.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/translators/documentables/JavadocPageContentBuilder.kt
@@ -1,16 +1,15 @@
package org.jetbrains.dokka.javadoc.translators.documentables
-import org.jetbrains.dokka.javadoc.pages.JavadocSignatureContentNode
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
+import org.jetbrains.dokka.javadoc.pages.JavadocSignatureContentNode
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.ContentKind
import org.jetbrains.dokka.pages.ContentNode
import org.jetbrains.dokka.utilities.DokkaLogger
-import java.lang.IllegalStateException
class JavadocPageContentBuilder(
commentsConverter: CommentsToContentConverter,
@@ -77,4 +76,4 @@ class JavadocPageContentBuilder(
supertypes = supertypes
)
}
-} \ No newline at end of file
+}
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/AbstractJavadocTemplateMapTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/AbstractJavadocTemplateMapTest.kt
index 4d059d0e..0e018b8e 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/AbstractJavadocTemplateMapTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/AbstractJavadocTemplateMapTest.kt
@@ -1,14 +1,16 @@
package org.jetbrains.dokka.javadoc
-import org.jetbrains.dokka.*
+import org.jetbrains.dokka.DokkaConfiguration
+import org.jetbrains.dokka.DokkaConfigurationImpl
+import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
+import org.jetbrains.dokka.javadoc.location.JavadocLocationProvider
import org.jetbrains.dokka.javadoc.pages.JavadocPageNode
import org.jetbrains.dokka.javadoc.renderer.JavadocContentToTemplateMapTranslator
-import org.jetbrains.dokka.javadoc.JavadocPlugin
-import org.jetbrains.dokka.javadoc.location.JavadocLocationProvider
+import org.jetbrains.dokka.jdk
+import org.jetbrains.dokka.kotlinStdlib
import org.jetbrains.dokka.model.withDescendants
import org.jetbrains.dokka.pages.RootPageNode
import org.jetbrains.dokka.plugability.*
-import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
internal abstract class AbstractJavadocTemplateMapTest : BaseAbstractTest() {
protected var config: DokkaConfigurationImpl = dokkaConfiguration {
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/Asserts.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/Asserts.kt
index 9f48b1db..ca739ed3 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/Asserts.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/Asserts.kt
@@ -1,6 +1,7 @@
package org.jetbrains.dokka.javadoc
-import kotlin.contracts.*
+import kotlin.contracts.ExperimentalContracts
+import kotlin.contracts.contract
// TODO replace with assertIs<T> from kotlin-test as part of #2924
@OptIn(ExperimentalContracts::class)
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAccessorNamingTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAccessorNamingTest.kt
index 907b032b..eca46421 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAccessorNamingTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/JavadocAccessorNamingTest.kt
@@ -1,9 +1,9 @@
package org.jetbrains.dokka.javadoc
import org.jsoup.Jsoup
-import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.assertEquals
-import utils.*
+import org.junit.jupiter.api.Test
+import utils.TestOutputWriterPlugin
internal class JavadocAccessorNamingTest : AbstractJavadocTemplateMapTest() {
@@ -77,4 +77,4 @@ internal class JavadocAccessorNamingTest : AbstractJavadocTemplateMapTest() {
}
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLinkingTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLinkingTest.kt
index 87c5246d..afb4f04c 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLinkingTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLinkingTest.kt
@@ -1,11 +1,11 @@
package org.jetbrains.dokka.javadoc.location
import org.jetbrains.dokka.DokkaConfiguration
+import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.jdk
import org.jetbrains.dokka.kotlinStdlib
import org.jetbrains.dokka.model.doc.DocumentationLink
import org.jetbrains.dokka.model.doc.Text
-import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.utilities.cast
import org.junit.jupiter.api.Test
import utils.TestOutputWriterPlugin
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt
index f0e2b49d..6f61f72b 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationTest.kt
@@ -1,19 +1,21 @@
package org.jetbrains.dokka.javadoc.location
-import org.jetbrains.dokka.*
+import org.jetbrains.dokka.DokkaConfiguration
+import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
+import org.jetbrains.dokka.javadoc.JavadocPlugin
import org.jetbrains.dokka.javadoc.pages.JavadocClasslikePageNode
+import org.jetbrains.dokka.javadoc.pages.JavadocFunctionNode
import org.jetbrains.dokka.javadoc.pages.JavadocPackagePageNode
import org.jetbrains.dokka.javadoc.renderer.JavadocContentToHtmlTranslator
-import org.jetbrains.dokka.javadoc.JavadocPlugin
+import org.jetbrains.dokka.jdk
+import org.jetbrains.dokka.kotlinStdlib
import org.jetbrains.dokka.model.firstChildOfType
import org.jetbrains.dokka.pages.RootPageNode
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.plugin
import org.jetbrains.dokka.plugability.querySingle
-import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
-import org.jetbrains.dokka.javadoc.pages.JavadocFunctionNode
-import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.assertEquals
+import org.junit.jupiter.api.Test
class JavadocLocationTest : BaseAbstractTest() {
diff --git a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt
index 89e4c535..1947fec7 100644
--- a/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt
+++ b/plugins/javadoc/src/test/kotlin/org/jetbrains/dokka/javadoc/packagelist/JavadocPackageListTest.kt
@@ -1,9 +1,9 @@
package org.jetbrains.dokka.javadoc.packagelist
import org.jetbrains.dokka.javadoc.AbstractJavadocTemplateMapTest
+import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import utils.TestOutputWriterPlugin
-import org.junit.jupiter.api.Assertions.*
internal class JavadocPackageListTest : AbstractJavadocTemplateMapTest() {
@Test