aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/DokkaGenerator.kt12
-rw-r--r--core/src/main/kotlin/model/Documentable.kt190
-rw-r--r--core/src/main/kotlin/model/documentableProperties.kt6
-rw-r--r--core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentableTranslator.kt4
-rw-r--r--core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt4
-rw-r--r--core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt4
-rw-r--r--core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt4
-rw-r--r--core/src/main/kotlin/transformers/psi/PsiToDocumentableTranslator.kt4
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt4
-rw-r--r--plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt35
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt116
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt78
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultDocumentableToPageTranslator.kt4
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt18
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt40
-rw-r--r--plugins/base/src/test/kotlin/enums/EnumsTest.kt5
-rw-r--r--plugins/base/src/test/kotlin/issues/IssuesTest.kt18
-rw-r--r--plugins/base/src/test/kotlin/markdown/KDocTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/model/ClassesTest.kt60
-rw-r--r--plugins/base/src/test/kotlin/model/CommentTest.kt32
-rw-r--r--plugins/base/src/test/kotlin/model/FunctionsTest.kt18
-rw-r--r--plugins/base/src/test/kotlin/model/JavaTest.kt38
-rw-r--r--plugins/base/src/test/kotlin/model/PackagesTest.kt16
-rw-r--r--plugins/base/src/test/kotlin/model/PropertyTest.kt20
-rw-r--r--plugins/base/src/test/kotlin/utils/ModelUtils.kt6
-rw-r--r--plugins/base/src/test/kotlin/utils/TestUtils.kt8
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt54
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt34
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/transformers/KotlinAsJavaDocumentableTransformer.kt4
-rw-r--r--testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt14
30 files changed, 422 insertions, 432 deletions
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt
index 1a0822d7..a3f72220 100644
--- a/core/src/main/kotlin/DokkaGenerator.kt
+++ b/core/src/main/kotlin/DokkaGenerator.kt
@@ -5,7 +5,7 @@ import com.intellij.psi.PsiJavaFile
import com.intellij.psi.PsiManager
import org.jetbrains.dokka.analysis.AnalysisEnvironment
import org.jetbrains.dokka.analysis.DokkaResolutionFacade
-import org.jetbrains.dokka.model.Module
+import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.PlatformData
import org.jetbrains.dokka.pages.RootPageNode
import org.jetbrains.dokka.plugability.DokkaContext
@@ -76,17 +76,17 @@ class DokkaGenerator(
platforms.map { (pdata, _) -> translatePsi(pdata, context) }
fun mergeDocumentationModels(
- modulesFromPlatforms: List<Module>,
+ modulesFromPlatforms: List<DModule>,
context: DokkaContext
) = context.single(CoreExtensions.documentableMerger).invoke(modulesFromPlatforms, context)
fun transformDocumentationModel(
- documentationModel: Module,
+ documentationModel: DModule,
context: DokkaContext
) = context[CoreExtensions.documentableTransformer].fold(documentationModel) { acc, t -> t(acc, context) }
fun createPages(
- transformedDocumentation: Module,
+ transformedDocumentation: DModule,
context: DokkaContext
) = context.single(CoreExtensions.documentableToPageTranslator).invoke(transformedDocumentation)
@@ -119,7 +119,7 @@ class DokkaGenerator(
EnvironmentAndFacade(environment, facade)
}
- private fun translateDescriptors(platformData: PlatformData, context: DokkaContext): Module {
+ private fun translateDescriptors(platformData: PlatformData, context: DokkaContext): DModule {
val (environment, facade) = context.platforms.getValue(platformData)
val packageFragments = environment.getSourceFiles().asSequence()
@@ -132,7 +132,7 @@ class DokkaGenerator(
.invoke(platformData.name, packageFragments, platformData)
}
- private fun translatePsi(platformData: PlatformData, context: DokkaContext): Module {
+ private fun translatePsi(platformData: PlatformData, context: DokkaContext): DModule {
val (environment, _) = context.platforms.getValue(platformData)
val sourceRoots = environment.configuration.get(CLIConfigurationKeys.CONTENT_ROOTS)
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt
index b697f4e4..22930bf2 100644
--- a/core/src/main/kotlin/model/Documentable.kt
+++ b/core/src/main/kotlin/model/Documentable.kt
@@ -48,9 +48,9 @@ interface WithExpectActual {
}
interface WithScope {
- val functions: List<Function>
- val properties: List<Property>
- val classlikes: List<Classlike>
+ val functions: List<DFunction>
+ val properties: List<DProperty>
+ val classlikes: List<DClasslike>
}
interface WithVisibility {
@@ -81,15 +81,15 @@ sealed class JavaModifier(name: String) : Modifier(name) {
}
interface WithCompanion {
- val companion: Object?
+ val companion: DObject?
}
interface WithConstructors {
- val constructors: List<Function>
+ val constructors: List<DFunction>
}
interface WithGenerics {
- val generics: List<TypeParameter>
+ val generics: List<DTypeParameter>
}
interface WithSupertypes {
@@ -97,232 +97,232 @@ interface WithSupertypes {
}
interface Callable : WithVisibility, WithType, WithAbstraction, WithExpectActual {
- val receiver: Parameter?
+ val receiver: DParameter?
}
-abstract class Classlike : Documentable(), WithScope, WithVisibility, WithExpectActual
+abstract class DClasslike : Documentable(), WithScope, WithVisibility, WithExpectActual
-data class Module(
+data class DModule(
override val name: String,
- val packages: List<Package>,
+ val packages: List<DPackage>,
override val documentation: PlatformDependent<DocumentationNode>,
override val platformData: List<PlatformData>,
- override val extra: PropertyContainer<Module> = PropertyContainer.empty()
-) : Documentable(), WithExtraProperties<Module> {
+ override val extra: PropertyContainer<DModule> = PropertyContainer.empty()
+) : Documentable(), WithExtraProperties<DModule> {
override val dri: DRI = DRI.topLevel
override val children: List<Documentable>
get() = packages
- override fun withNewExtras(newExtras: PropertyContainer<Module>) = copy(extra = newExtras)
+ override fun withNewExtras(newExtras: PropertyContainer<DModule>) = copy(extra = newExtras)
}
-data class Package(
+data class DPackage(
override val dri: DRI,
- override val functions: List<Function>,
- override val properties: List<Property>,
- override val classlikes: List<Classlike>,
+ override val functions: List<DFunction>,
+ override val properties: List<DProperty>,
+ override val classlikes: List<DClasslike>,
override val documentation: PlatformDependent<DocumentationNode>,
override val platformData: List<PlatformData>,
- override val extra: PropertyContainer<Package> = PropertyContainer.empty()
-) : Documentable(), WithScope, WithExtraProperties<Package> {
+ override val extra: PropertyContainer<DPackage> = PropertyContainer.empty()
+) : Documentable(), WithScope, WithExtraProperties<DPackage> {
override val name = dri.packageName.orEmpty()
override val children: List<Documentable>
get() = (properties + functions + classlikes) as List<Documentable>
- override fun withNewExtras(newExtras: PropertyContainer<Package>) = copy(extra = newExtras)
+ override fun withNewExtras(newExtras: PropertyContainer<DPackage>) = copy(extra = newExtras)
}
-data class Class(
+data class DClass(
override val dri: DRI,
override val name: String,
- override val constructors: List<Function>,
- override val functions: List<Function>,
- override val properties: List<Property>,
- override val classlikes: List<Classlike>,
+ override val constructors: List<DFunction>,
+ override val functions: List<DFunction>,
+ override val properties: List<DProperty>,
+ override val classlikes: List<DClasslike>,
override val sources: PlatformDependent<DocumentableSource>,
override val visibility: PlatformDependent<Visibility>,
- override val companion: Object?,
- override val generics: List<TypeParameter>,
+ override val companion: DObject?,
+ override val generics: List<DTypeParameter>,
override val supertypes: PlatformDependent<List<DRI>>,
override val documentation: PlatformDependent<DocumentationNode>,
override val modifier: Modifier,
override val platformData: List<PlatformData>,
- override val extra: PropertyContainer<Class> = PropertyContainer.empty()
-) : Classlike(), WithAbstraction, WithCompanion, WithConstructors, WithGenerics, WithSupertypes,
- WithExtraProperties<Class> {
+ override val extra: PropertyContainer<DClass> = PropertyContainer.empty()
+) : DClasslike(), WithAbstraction, WithCompanion, WithConstructors, WithGenerics, WithSupertypes,
+ WithExtraProperties<DClass> {
override val children: List<Documentable>
get() = (functions + properties + classlikes + constructors) as List<Documentable>
- override fun withNewExtras(newExtras: PropertyContainer<Class>) = copy(extra = newExtras)
+ override fun withNewExtras(newExtras: PropertyContainer<DClass>) = copy(extra = newExtras)
}
-data class Enum(
+data class DEnum(
override val dri: DRI,
override val name: String,
- val entries: List<EnumEntry>,
+ val entries: List<DEnumEntry>,
override val documentation: PlatformDependent<DocumentationNode>,
override val sources: PlatformDependent<DocumentableSource>,
- override val functions: List<Function>,
- override val properties: List<Property>,
- override val classlikes: List<Classlike>,
+ override val functions: List<DFunction>,
+ override val properties: List<DProperty>,
+ override val classlikes: List<DClasslike>,
override val visibility: PlatformDependent<Visibility>,
- override val companion: Object?,
- override val constructors: List<Function>,
+ override val companion: DObject?,
+ override val constructors: List<DFunction>,
override val supertypes: PlatformDependent<List<DRI>>,
override val platformData: List<PlatformData>,
- override val extra: PropertyContainer<Enum> = PropertyContainer.empty()
-) : Classlike(), WithCompanion, WithConstructors, WithSupertypes, WithExtraProperties<Enum> {
+ override val extra: PropertyContainer<DEnum> = PropertyContainer.empty()
+) : DClasslike(), WithCompanion, WithConstructors, WithSupertypes, WithExtraProperties<DEnum> {
override val children: List<Documentable>
get() = (entries + functions + properties + classlikes + constructors) as List<Documentable>
- override fun withNewExtras(newExtras: PropertyContainer<Enum>) = copy(extra = newExtras)
+ override fun withNewExtras(newExtras: PropertyContainer<DEnum>) = copy(extra = newExtras)
}
-data class EnumEntry(
+data class DEnumEntry(
override val dri: DRI,
override val name: String,
override val documentation: PlatformDependent<DocumentationNode>,
- override val functions: List<Function>,
- override val properties: List<Property>,
- override val classlikes: List<Classlike>,
+ override val functions: List<DFunction>,
+ override val properties: List<DProperty>,
+ override val classlikes: List<DClasslike>,
override val platformData: List<PlatformData>,
- override val extra: PropertyContainer<EnumEntry> = PropertyContainer.empty()
-) : Documentable(), WithScope, WithExtraProperties<EnumEntry> {
+ override val extra: PropertyContainer<DEnumEntry> = PropertyContainer.empty()
+) : Documentable(), WithScope, WithExtraProperties<DEnumEntry> {
override val children: List<Documentable>
get() = (functions + properties + classlikes) as List<Documentable>
- override fun withNewExtras(newExtras: PropertyContainer<EnumEntry>) = copy(extra = newExtras)
+ override fun withNewExtras(newExtras: PropertyContainer<DEnumEntry>) = copy(extra = newExtras)
}
-data class Function(
+data class DFunction(
override val dri: DRI,
override val name: String,
val isConstructor: Boolean,
- val parameters: List<Parameter>,
+ val parameters: List<DParameter>,
override val documentation: PlatformDependent<DocumentationNode>,
override val sources: PlatformDependent<DocumentableSource>,
override val visibility: PlatformDependent<Visibility>,
override val type: Bound,
- override val generics: List<TypeParameter>,
- override val receiver: Parameter?,
+ override val generics: List<DTypeParameter>,
+ override val receiver: DParameter?,
override val modifier: Modifier,
override val platformData: List<PlatformData>,
- override val extra: PropertyContainer<Function> = PropertyContainer.empty()
-) : Documentable(), Callable, WithGenerics, WithExtraProperties<Function> {
+ override val extra: PropertyContainer<DFunction> = PropertyContainer.empty()
+) : Documentable(), Callable, WithGenerics, WithExtraProperties<DFunction> {
override val children: List<Documentable>
get() = parameters
- override fun withNewExtras(newExtras: PropertyContainer<Function>) = copy(extra = newExtras)
+ override fun withNewExtras(newExtras: PropertyContainer<DFunction>) = copy(extra = newExtras)
}
-data class Interface(
+data class DInterface(
override val dri: DRI,
override val name: String,
override val documentation: PlatformDependent<DocumentationNode>,
override val sources: PlatformDependent<DocumentableSource>,
- override val functions: List<Function>,
- override val properties: List<Property>,
- override val classlikes: List<Classlike>,
+ override val functions: List<DFunction>,
+ override val properties: List<DProperty>,
+ override val classlikes: List<DClasslike>,
override val visibility: PlatformDependent<Visibility>,
- override val companion: Object?,
- override val generics: List<TypeParameter>,
+ override val companion: DObject?,
+ override val generics: List<DTypeParameter>,
override val supertypes: PlatformDependent<List<DRI>>,
override val platformData: List<PlatformData>,
- override val extra: PropertyContainer<Interface> = PropertyContainer.empty()
-) : Classlike(), WithCompanion, WithGenerics, WithSupertypes, WithExtraProperties<Interface> {
+ override val extra: PropertyContainer<DInterface> = PropertyContainer.empty()
+) : DClasslike(), WithCompanion, WithGenerics, WithSupertypes, WithExtraProperties<DInterface> {
override val children: List<Documentable>
get() = (functions + properties + classlikes) as List<Documentable>
- override fun withNewExtras(newExtras: PropertyContainer<Interface>) = copy(extra = newExtras)
+ override fun withNewExtras(newExtras: PropertyContainer<DInterface>) = copy(extra = newExtras)
}
-data class Object(
+data class DObject(
override val name: String?,
override val dri: DRI,
override val documentation: PlatformDependent<DocumentationNode>,
override val sources: PlatformDependent<DocumentableSource>,
- override val functions: List<Function>,
- override val properties: List<Property>,
- override val classlikes: List<Classlike>,
+ override val functions: List<DFunction>,
+ override val properties: List<DProperty>,
+ override val classlikes: List<DClasslike>,
override val visibility: PlatformDependent<Visibility>,
override val supertypes: PlatformDependent<List<DRI>>,
override val platformData: List<PlatformData>,
- override val extra: PropertyContainer<Object> = PropertyContainer.empty()
-) : Classlike(), WithSupertypes, WithExtraProperties<Object> {
+ override val extra: PropertyContainer<DObject> = PropertyContainer.empty()
+) : DClasslike(), WithSupertypes, WithExtraProperties<DObject> {
override val children: List<Documentable>
get() = (functions + properties + classlikes) as List<Documentable>
- override fun withNewExtras(newExtras: PropertyContainer<Object>) = copy(extra = newExtras)
+ override fun withNewExtras(newExtras: PropertyContainer<DObject>) = copy(extra = newExtras)
}
-data class Annotation(
+data class DAnnotation(
override val name: String,
override val dri: DRI,
override val documentation: PlatformDependent<DocumentationNode>,
override val sources: PlatformDependent<DocumentableSource>,
- override val functions: List<Function>,
- override val properties: List<Property>,
- override val classlikes: List<Classlike>,
+ override val functions: List<DFunction>,
+ override val properties: List<DProperty>,
+ override val classlikes: List<DClasslike>,
override val visibility: PlatformDependent<Visibility>,
- override val companion: Object?,
- override val constructors: List<Function>,
+ override val companion: DObject?,
+ override val constructors: List<DFunction>,
override val platformData: List<PlatformData>,
- override val extra: PropertyContainer<Annotation> = PropertyContainer.empty()
-) : Classlike(), WithCompanion, WithConstructors, WithExtraProperties<Annotation> {
+ override val extra: PropertyContainer<DAnnotation> = PropertyContainer.empty()
+) : DClasslike(), WithCompanion, WithConstructors, WithExtraProperties<DAnnotation> {
override val children: List<Documentable>
get() = (functions + properties + classlikes + constructors) as List<Documentable>
- override fun withNewExtras(newExtras: PropertyContainer<Annotation>) = copy(extra = newExtras)
+ override fun withNewExtras(newExtras: PropertyContainer<DAnnotation>) = copy(extra = newExtras)
}
-data class Property(
+data class DProperty(
override val dri: DRI,
override val name: String,
override val documentation: PlatformDependent<DocumentationNode>,
override val sources: PlatformDependent<DocumentableSource>,
override val visibility: PlatformDependent<Visibility>,
override val type: Bound,
- override val receiver: Parameter?,
- val setter: Function?,
- val getter: Function?,
+ override val receiver: DParameter?,
+ val setter: DFunction?,
+ val getter: DFunction?,
override val modifier: Modifier,
override val platformData: List<PlatformData>,
- override val extra: PropertyContainer<Property> = PropertyContainer.empty()
-) : Documentable(), Callable, WithExtraProperties<Property> {
+ override val extra: PropertyContainer<DProperty> = PropertyContainer.empty()
+) : Documentable(), Callable, WithExtraProperties<DProperty> {
override val children: List<Nothing>
get() = emptyList()
- override fun withNewExtras(newExtras: PropertyContainer<Property>) = copy(extra = newExtras)
+ override fun withNewExtras(newExtras: PropertyContainer<DProperty>) = copy(extra = newExtras)
}
// TODO: treat named Parameters and receivers differently
-data class Parameter(
+data class DParameter(
override val dri: DRI,
override val name: String?,
override val documentation: PlatformDependent<DocumentationNode>,
val type: Bound,
override val platformData: List<PlatformData>,
- override val extra: PropertyContainer<Parameter> = PropertyContainer.empty()
-) : Documentable(), WithExtraProperties<Parameter> {
+ override val extra: PropertyContainer<DParameter> = PropertyContainer.empty()
+) : Documentable(), WithExtraProperties<DParameter> {
override val children: List<Nothing>
get() = emptyList()
- override fun withNewExtras(newExtras: PropertyContainer<Parameter>) = copy(extra = newExtras)
+ override fun withNewExtras(newExtras: PropertyContainer<DParameter>) = copy(extra = newExtras)
}
-data class TypeParameter(
+data class DTypeParameter(
override val dri: DRI,
override val name: String,
override val documentation: PlatformDependent<DocumentationNode>,
val bounds: List<Bound>,
override val platformData: List<PlatformData>,
- override val extra: PropertyContainer<TypeParameter> = PropertyContainer.empty()
-) : Documentable(), WithExtraProperties<TypeParameter> {
+ override val extra: PropertyContainer<DTypeParameter> = PropertyContainer.empty()
+) : Documentable(), WithExtraProperties<DTypeParameter> {
override val children: List<Nothing>
get() = emptyList()
- override fun withNewExtras(newExtras: PropertyContainer<TypeParameter>) = copy(extra = newExtras)
+ override fun withNewExtras(newExtras: PropertyContainer<DTypeParameter>) = copy(extra = newExtras)
}
sealed class Projection
diff --git a/core/src/main/kotlin/model/documentableProperties.kt b/core/src/main/kotlin/model/documentableProperties.kt
index 38a06451..67e5e88d 100644
--- a/core/src/main/kotlin/model/documentableProperties.kt
+++ b/core/src/main/kotlin/model/documentableProperties.kt
@@ -3,12 +3,12 @@ package org.jetbrains.dokka.model
import org.jetbrains.dokka.model.properties.ExtraProperty
import org.jetbrains.dokka.model.properties.MergeStrategy
-data class InheritedFunction(val isInherited: Boolean): ExtraProperty<Function> {
- object InheritedFunctionKey: ExtraProperty.Key<Function, Boolean> {
+data class InheritedFunction(val isInherited: Boolean): ExtraProperty<DFunction> {
+ object InheritedFunctionKey: ExtraProperty.Key<DFunction, Boolean> {
override fun mergeStrategyFor(left: Boolean, right: Boolean) = MergeStrategy.Fail {
throw IllegalArgumentException("Function inheritance should be consistent!")
}
}
- override val key: ExtraProperty.Key<Function, Boolean> =
+ override val key: ExtraProperty.Key<DFunction, Boolean> =
InheritedFunctionKey
} \ No newline at end of file
diff --git a/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentableTranslator.kt b/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentableTranslator.kt
index d72eeafd..ca66b90a 100644
--- a/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentableTranslator.kt
+++ b/core/src/main/kotlin/transformers/descriptors/DescriptorToDocumentableTranslator.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka.transformers.descriptors
-import org.jetbrains.dokka.model.Module
+import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.PlatformData
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
@@ -9,5 +9,5 @@ interface DescriptorToDocumentableTranslator {
moduleName: String,
packageFragments: Iterable<PackageFragmentDescriptor>,
platformData: PlatformData
- ): Module
+ ): DModule
} \ No newline at end of file
diff --git a/core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt b/core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt
index 5a17bc24..c8ae9c02 100644
--- a/core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt
+++ b/core/src/main/kotlin/transformers/documentation/DocumentableMerger.kt
@@ -1,8 +1,8 @@
package org.jetbrains.dokka.transformers.documentation
-import org.jetbrains.dokka.model.Module
+import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.plugability.DokkaContext
interface DocumentableMerger {
- operator fun invoke(modules: Collection<Module>, context: DokkaContext): Module
+ operator fun invoke(modules: Collection<DModule>, context: DokkaContext): DModule
} \ No newline at end of file
diff --git a/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt b/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt
index e41e0c84..83456f01 100644
--- a/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt
+++ b/core/src/main/kotlin/transformers/documentation/DocumentableToPageTranslator.kt
@@ -1,8 +1,8 @@
package org.jetbrains.dokka.transformers.documentation
-import org.jetbrains.dokka.model.Module
+import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.ModulePageNode
interface DocumentableToPageTranslator {
- operator fun invoke(module: Module): ModulePageNode
+ operator fun invoke(module: DModule): ModulePageNode
} \ No newline at end of file
diff --git a/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt b/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt
index 88a1514d..3eb4704e 100644
--- a/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt
+++ b/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt
@@ -1,8 +1,8 @@
package org.jetbrains.dokka.transformers.documentation
-import org.jetbrains.dokka.model.Module
+import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.plugability.DokkaContext
interface DocumentableTransformer {
- operator fun invoke(original: Module, context: DokkaContext): Module
+ operator fun invoke(original: DModule, context: DokkaContext): DModule
} \ No newline at end of file
diff --git a/core/src/main/kotlin/transformers/psi/PsiToDocumentableTranslator.kt b/core/src/main/kotlin/transformers/psi/PsiToDocumentableTranslator.kt
index 1ea07ff3..6f5025bd 100644
--- a/core/src/main/kotlin/transformers/psi/PsiToDocumentableTranslator.kt
+++ b/core/src/main/kotlin/transformers/psi/PsiToDocumentableTranslator.kt
@@ -1,7 +1,7 @@
package org.jetbrains.dokka.transformers.psi
import com.intellij.psi.PsiJavaFile
-import org.jetbrains.dokka.model.Module
+import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.PlatformData
import org.jetbrains.dokka.plugability.DokkaContext
@@ -11,5 +11,5 @@ interface PsiToDocumentableTranslator {
psiFiles: List<PsiJavaFile>,
platformData: PlatformData,
context: DokkaContext
- ): Module
+ ): DModule
}
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index d7b2a912..34dac9f4 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -4,7 +4,7 @@ import kotlinx.html.*
import kotlinx.html.stream.createHTML
import org.jetbrains.dokka.base.renderers.DefaultRenderer
import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
import java.io.File
@@ -269,7 +269,7 @@ private fun PageNode.pageKind() = when (this) {
is PackagePageNode -> "package"
is ClasslikePageNode -> "class"
is MemberPageNode -> when (this.documentable) {
- is Function -> "function"
+ is DFunction -> "function"
else -> "other"
}
else -> "other"
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
index f600a3bf..8a080bb9 100644
--- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
+++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
@@ -6,12 +6,11 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.DriOfUnit
import org.jetbrains.dokka.links.sureClassNames
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Annotation
-import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DAnnotation
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.pages.ContentKind
import org.jetbrains.dokka.pages.ContentNode
-import org.jetbrains.dokka.pages.PlatformData
import org.jetbrains.dokka.pages.TextStyle
import org.jetbrains.dokka.utilities.DokkaLogger
@@ -21,26 +20,26 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
private val ignoredVisibilities = setOf(JavaVisibility.Default, KotlinVisibility.Public)
override fun signature(documentable: Documentable): ContentNode = when (documentable) {
- is Function -> signature(documentable)
- is Property -> signature(documentable)
- is Classlike -> signature(documentable)
- is TypeParameter -> signature(documentable)
+ is DFunction -> signature(documentable)
+ is DProperty -> signature(documentable)
+ is DClasslike -> signature(documentable)
+ is DTypeParameter -> signature(documentable)
else -> throw NotImplementedError(
"Cannot generate signature for ${documentable::class.qualifiedName} ${documentable.name}"
)
}
- private fun signature(c: Classlike) = contentBuilder.contentFor(c, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
+ private fun signature(c: DClasslike) = contentBuilder.contentFor(c, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
platformText(c.visibility) { (it.takeIf { it !in ignoredVisibilities }?.name ?: "") + " " }
- if (c is Class) {
+ if (c is DClass) {
text(c.modifier.name + " ")
}
when (c) {
- is Class -> text("class ")
- is Interface -> text("interface ")
- is Enum -> text("enum ")
- is Object -> text("object ")
- is Annotation -> text("annotation class ")
+ is DClass -> text("class ")
+ is DInterface -> text("interface ")
+ is DEnum -> text("enum ")
+ is DObject -> text("object ")
+ is DAnnotation -> text("annotation class ")
}
link(c.name!!, c.dri)
if (c is WithSupertypes) {
@@ -52,11 +51,11 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
}
}
- private fun signature(p: Property) = contentBuilder.contentFor(p, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
+ private fun signature(p: DProperty) = contentBuilder.contentFor(p, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
signatureForProjection(p.type)
}
- private fun signature(f: Function) = contentBuilder.contentFor(f, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
+ private fun signature(f: DFunction) = contentBuilder.contentFor(f, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
platformText(f.visibility) { (it.takeIf { it !in ignoredVisibilities }?.name ?: "") + " " }
text(f.modifier.name + " ")
text("fun ")
@@ -82,7 +81,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
}
}
- private fun signature(t: TypeParameter) = contentBuilder.contentFor(t) {
+ private fun signature(t: DTypeParameter) = contentBuilder.contentFor(t) {
link(t.name, t.dri)
list(t.bounds, prefix = " : ") {
signatureForProjection(it)
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
index 4d47401b..bb7dbaaf 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
@@ -1,10 +1,10 @@
package org.jetbrains.dokka.base.transformers.documentables
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.Function
-import org.jetbrains.dokka.model.Package
-import org.jetbrains.dokka.model.Annotation
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DFunction
+import org.jetbrains.dokka.model.DPackage
+import org.jetbrains.dokka.model.DAnnotation
import org.jetbrains.dokka.model.properties.mergeExtras
import org.jetbrains.dokka.pages.PlatformData
import org.jetbrains.dokka.plugability.DokkaContext
@@ -12,7 +12,7 @@ import org.jetbrains.dokka.transformers.documentation.DocumentableMerger
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
internal object DefaultDocumentableMerger : DocumentableMerger {
- override fun invoke(modules: Collection<Module>, context: DokkaContext): Module {
+ override fun invoke(modules: Collection<DModule>, context: DokkaContext): DModule {
val name = modules.map { it.name }.distinct().singleOrNull() ?: run {
context.logger.error("All module names need to be the same")
modules.first().name
@@ -21,11 +21,11 @@ internal object DefaultDocumentableMerger : DocumentableMerger {
return modules.reduce { left, right ->
val list = listOf(left, right)
- Module(
+ DModule(
name = name,
packages = merge(
list.flatMap { it.packages },
- Package::mergeWith
+ DPackage::mergeWith
),
documentation = list.platformDependentFor { documentation },
platformData = list.flatMap { it.platformData }.distinct()
@@ -106,25 +106,25 @@ private sealed class Expect<out T : Any> {
}
}
-fun Package.mergeWith(other: Package): Package = copy(
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+fun DPackage.mergeWith(other: DPackage): DPackage = copy(
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
documentation = documentation.mergeWith(other.documentation),
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun Function.mergeWith(other: Function): Function = copy(
- parameters = merge(this.parameters + other.parameters, Parameter::mergeWith),
+fun DFunction.mergeWith(other: DFunction): DFunction = copy(
+ parameters = merge(this.parameters + other.parameters, DParameter::mergeWith),
receiver = receiver?.let { r -> other.receiver?.let { r.mergeWith(it) } ?: r } ?: other.receiver,
documentation = documentation.mergeWith(other.documentation),
sources = sources.mergeWith(other.sources),
visibility = visibility.mergeWith(other.visibility),
platformData = (platformData + other.platformData).distinct(),
- generics = merge(generics + other.generics, TypeParameter::mergeWith)
+ generics = merge(generics + other.generics, DTypeParameter::mergeWith)
).mergeExtras(this, other)
-fun Property.mergeWith(other: Property): Property = copy(
+fun DProperty.mergeWith(other: DProperty): DProperty = copy(
receiver = receiver?.let { r -> other.receiver?.let { r.mergeWith(it) } ?: r } ?: other.receiver,
documentation = documentation.mergeWith(other.documentation),
sources = sources.mergeWith(other.sources),
@@ -134,33 +134,33 @@ fun Property.mergeWith(other: Property): Property = copy(
setter = setter?.let { s -> other.setter?.let { s.mergeWith(it) } ?: s } ?: other.setter
).mergeExtras(this, other)
-fun Classlike.setPlatformData(platformData: List<PlatformData>): Classlike = when (this) {
- is Class -> copy(platformData = platformData)
- is Enum -> copy(platformData = platformData)
- is Interface -> copy(platformData = platformData)
- is Object -> copy(platformData = platformData)
+fun DClasslike.setPlatformData(platformData: List<PlatformData>): DClasslike = when (this) {
+ is DClass -> copy(platformData = platformData)
+ is DEnum -> copy(platformData = platformData)
+ is DInterface -> copy(platformData = platformData)
+ is DObject -> copy(platformData = platformData)
else -> throw IllegalStateException("${this::class.qualifiedName} ${this.name} cannot have platform set")
}
-fun Classlike.mergeWith(other: Classlike): Classlike = when {
- this is Class && other is Class -> mergeWith(other)
- this is Enum && other is Enum -> mergeWith(other)
- this is Interface && other is Interface -> mergeWith(other)
- this is Object && other is Object -> mergeWith(other)
- this is Annotation && other is Annotation -> mergeWith(other)
+fun DClasslike.mergeWith(other: DClasslike): DClasslike = when {
+ this is DClass && other is DClass -> mergeWith(other)
+ this is DEnum && other is DEnum -> mergeWith(other)
+ this is DInterface && other is DInterface -> mergeWith(other)
+ this is DObject && other is DObject -> mergeWith(other)
+ this is DAnnotation && other is DAnnotation -> mergeWith(other)
else -> throw IllegalStateException("${this::class.qualifiedName} ${this.name} cannot be mergesd with ${other::class.qualifiedName} ${other.name}")
}
-fun Class.mergeWith(other: Class): Class = copy(
+fun DClass.mergeWith(other: DClass): DClass = copy(
constructors = mergeExpectActual(
constructors + other.constructors,
- Function::mergeWith
+ DFunction::mergeWith
) { copy(platformData = it) },
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
companion = companion?.let { c -> other.companion?.let { c.mergeWith(it) } ?: c } ?: other.companion,
- generics = merge(generics + other.generics, TypeParameter::mergeWith),
+ generics = merge(generics + other.generics, DTypeParameter::mergeWith),
supertypes = supertypes.mergeWith(other.supertypes),
documentation = documentation.mergeWith(other.documentation),
sources = sources.mergeWith(other.sources),
@@ -168,15 +168,15 @@ fun Class.mergeWith(other: Class): Class = copy(
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun Enum.mergeWith(other: Enum): Enum = copy(
- entries = merge(entries + other.entries, EnumEntry::mergeWith),
+fun DEnum.mergeWith(other: DEnum): DEnum = copy(
+ entries = merge(entries + other.entries, DEnumEntry::mergeWith),
constructors = mergeExpectActual(
constructors + other.constructors,
- Function::mergeWith
+ DFunction::mergeWith
) { copy(platformData = it) },
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
companion = companion?.let { c -> other.companion?.let { c.mergeWith(it) } ?: c } ?: other.companion,
supertypes = supertypes.mergeWith(other.supertypes),
documentation = documentation.mergeWith(other.documentation),
@@ -185,18 +185,18 @@ fun Enum.mergeWith(other: Enum): Enum = copy(
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun EnumEntry.mergeWith(other: EnumEntry): EnumEntry = copy(
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+fun DEnumEntry.mergeWith(other: DEnumEntry): DEnumEntry = copy(
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
documentation = documentation.mergeWith(other.documentation),
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun Object.mergeWith(other: Object): Object = copy(
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+fun DObject.mergeWith(other: DObject): DObject = copy(
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
supertypes = supertypes.mergeWith(other.supertypes),
documentation = documentation.mergeWith(other.documentation),
sources = sources.mergeWith(other.sources),
@@ -204,12 +204,12 @@ fun Object.mergeWith(other: Object): Object = copy(
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun Interface.mergeWith(other: Interface): Interface = copy(
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+fun DInterface.mergeWith(other: DInterface): DInterface = copy(
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
companion = companion?.let { c -> other.companion?.let { c.mergeWith(it) } ?: c } ?: other.companion,
- generics = merge(generics + other.generics, TypeParameter::mergeWith),
+ generics = merge(generics + other.generics, DTypeParameter::mergeWith),
supertypes = supertypes.mergeWith(other.supertypes),
documentation = documentation.mergeWith(other.documentation),
sources = sources.mergeWith(other.sources),
@@ -217,14 +217,14 @@ fun Interface.mergeWith(other: Interface): Interface = copy(
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun Annotation.mergeWith(other: Annotation): Annotation = copy(
+fun DAnnotation.mergeWith(other: DAnnotation): DAnnotation = copy(
constructors = mergeExpectActual(
constructors + other.constructors,
- Function::mergeWith
+ DFunction::mergeWith
) { copy(platformData = it) },
- functions = mergeExpectActual(functions + other.functions, Function::mergeWith) { copy(platformData = it) },
- properties = mergeExpectActual(properties + other.properties, Property::mergeWith) { copy(platformData = it) },
- classlikes = mergeExpectActual(classlikes + other.classlikes, Classlike::mergeWith, Classlike::setPlatformData),
+ functions = mergeExpectActual(functions + other.functions, DFunction::mergeWith) { copy(platformData = it) },
+ properties = mergeExpectActual(properties + other.properties, DProperty::mergeWith) { copy(platformData = it) },
+ classlikes = mergeExpectActual(classlikes + other.classlikes, DClasslike::mergeWith, DClasslike::setPlatformData),
companion = companion?.let { c -> other.companion?.let { c.mergeWith(it) } ?: c } ?: other.companion,
documentation = documentation.mergeWith(other.documentation),
sources = sources.mergeWith(other.sources),
@@ -232,12 +232,12 @@ fun Annotation.mergeWith(other: Annotation): Annotation = copy(
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun Parameter.mergeWith(other: Parameter): Parameter = copy(
+fun DParameter.mergeWith(other: DParameter): DParameter = copy(
documentation = documentation.mergeWith(other.documentation),
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other)
-fun TypeParameter.mergeWith(other: TypeParameter): TypeParameter = copy(
+fun DTypeParameter.mergeWith(other: DTypeParameter): DTypeParameter = copy(
documentation = documentation.mergeWith(other.documentation),
platformData = (platformData + other.platformData).distinct()
).mergeExtras(this, other) \ No newline at end of file
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index 9a71145f..eb23ffd7 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -5,8 +5,8 @@ import org.jetbrains.dokka.links.Callable
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.withClass
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.PlatformData
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorVisitorEmptyBo
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.calls.components.isVararg
import org.jetbrains.kotlin.resolve.calls.tasks.isDynamic
-import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.descriptorUtil.getAllSuperclassesWithoutAny
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassNotAny
import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperInterfaces
@@ -30,7 +29,6 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeProjection
import org.jetbrains.dokka.model.Variance
-import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf.fqName
import org.jetbrains.kotlin.idea.kdoc.findKDoc
class DefaultDescriptorToDocumentableTranslator(
@@ -47,7 +45,7 @@ class DefaultDescriptorToDocumentableTranslator(
DRIWithPlatformInfo(DRI.topLevel, PlatformDependent.empty())
)
}
- }.let { Module(moduleName, it, PlatformDependent.empty(), listOf(platformData)) }
+ }.let { DModule(moduleName, it, PlatformDependent.empty(), listOf(platformData)) }
}
@@ -69,11 +67,11 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
override fun visitPackageFragmentDescriptor(
descriptor: PackageFragmentDescriptor,
parent: DRIWithPlatformInfo
- ): Package {
+ ): DPackage {
val driWithPlatform = DRI(packageName = descriptor.fqName.asString()).withEmptyInfo()
val scope = descriptor.getMemberScope()
- return Package(
+ return DPackage(
dri = driWithPlatform.dri,
functions = scope.functions(driWithPlatform),
properties = scope.properties(driWithPlatform),
@@ -83,7 +81,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- override fun visitClassDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): Classlike =
+ override fun visitClassDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): DClasslike =
when (descriptor.kind) {
ClassKind.ENUM_CLASS -> enumDescriptor(descriptor, parent)
ClassKind.OBJECT -> objectDescriptor(descriptor, parent)
@@ -91,12 +89,12 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
else -> classDescriptor(descriptor, parent)
}
- private fun interfaceDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): Interface {
+ private fun interfaceDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): DInterface {
val driWithPlatform = parent.dri.withClass(descriptor.name.asString()).withEmptyInfo()
val scope = descriptor.unsubstitutedMemberScope
val info = descriptor.resolveClassDescriptionData(platformData)
- return Interface(
+ return DInterface(
dri = driWithPlatform.dri,
name = descriptor.name.asString(),
functions = scope.functions(driWithPlatform),
@@ -113,12 +111,12 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- private fun objectDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): Object {
+ private fun objectDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): DObject {
val driWithPlatform = parent.dri.withClass(descriptor.name.asString()).withEmptyInfo()
val scope = descriptor.unsubstitutedMemberScope
val info = descriptor.resolveClassDescriptionData(platformData)
- return Object(
+ return DObject(
dri = driWithPlatform.dri,
name = descriptor.name.asString(),
functions = scope.functions(driWithPlatform),
@@ -133,12 +131,12 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- private fun enumDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): Enum {
+ private fun enumDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): DEnum {
val driWithPlatform = parent.dri.withClass(descriptor.name.asString()).withEmptyInfo()
val scope = descriptor.unsubstitutedMemberScope
val info = descriptor.resolveClassDescriptionData(platformData)
- return Enum(
+ return DEnum(
dri = driWithPlatform.dri,
name = descriptor.name.asString(),
entries = scope.enumEntries(driWithPlatform),
@@ -156,11 +154,11 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- private fun enumEntryDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): EnumEntry {
+ private fun enumEntryDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): DEnumEntry {
val driWithPlatform = parent.dri.withClass(descriptor.name.asString()).withEmptyInfo()
val scope = descriptor.unsubstitutedMemberScope
- return EnumEntry(
+ return DEnumEntry(
dri = driWithPlatform.dri,
name = descriptor.name.asString(),
documentation = descriptor.resolveDescriptorData(platformData),
@@ -172,13 +170,13 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- private fun classDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): Class {
+ private fun classDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): DClass {
val driWithPlatform = parent.dri.withClass(descriptor.name.asString()).withEmptyInfo()
val scope = descriptor.unsubstitutedMemberScope
val info = descriptor.resolveClassDescriptionData(platformData)
val actual = descriptor.createSources()
- return Class(
+ return DClass(
dri = driWithPlatform.dri,
name = descriptor.name.asString(),
constructors = descriptor.constructors.map {
@@ -203,11 +201,11 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- override fun visitPropertyDescriptor(descriptor: PropertyDescriptor, parent: DRIWithPlatformInfo): Property {
+ override fun visitPropertyDescriptor(descriptor: PropertyDescriptor, parent: DRIWithPlatformInfo): DProperty {
val dri = parent.dri.copy(callable = Callable.from(descriptor))
val actual = descriptor.createSources()
- return Property(
+ return DProperty(
dri = dri,
name = descriptor.name.asString(),
receiver = descriptor.extensionReceiverParameter?.let {
@@ -229,11 +227,11 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- override fun visitFunctionDescriptor(descriptor: FunctionDescriptor, parent: DRIWithPlatformInfo): Function {
+ override fun visitFunctionDescriptor(descriptor: FunctionDescriptor, parent: DRIWithPlatformInfo): DFunction {
val dri = parent.dri.copy(callable = Callable.from(descriptor))
val actual = descriptor.createSources()
- return Function(
+ return DFunction(
dri = dri,
name = descriptor.name.asString(),
isConstructor = false,
@@ -254,10 +252,10 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
)
}
- override fun visitConstructorDescriptor(descriptor: ConstructorDescriptor, parent: DRIWithPlatformInfo): Function {
+ override fun visitConstructorDescriptor(descriptor: ConstructorDescriptor, parent: DRIWithPlatformInfo): DFunction {
val dri = parent.dri.copy(callable = Callable.from(descriptor))
val actual = descriptor.createSources()
- return Function(
+ return DFunction(
dri = dri,
name = "<init>",
isConstructor = true,
@@ -281,7 +279,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
override fun visitReceiverParameterDescriptor(
descriptor: ReceiverParameterDescriptor,
parent: DRIWithPlatformInfo
- ) = Parameter(
+ ) = DParameter(
dri = parent.dri.copy(target = 0),
name = null,
type = descriptor.type.toBound(),
@@ -293,12 +291,12 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
descriptor: PropertyAccessorDescriptor,
propertyDescriptor: PropertyDescriptor,
parent: DRI
- ): Function {
+ ): DFunction {
val dri = parent.copy(callable = Callable.from(descriptor))
val isGetter = descriptor is PropertyGetterDescriptor
fun PropertyDescriptor.asParameter(parent: DRI) =
- Parameter(
+ DParameter(
parent.copy(target = 1),
this.name.asString(),
type = this.type.toBound(),
@@ -320,7 +318,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
listOf(propertyDescriptor.asParameter(dri))
}
- return Function(
+ return DFunction(
dri,
name,
isConstructor = false,
@@ -343,7 +341,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
}
private fun parameter(index: Int, descriptor: ValueParameterDescriptor, parent: DRIWithPlatformInfo) =
- Parameter(
+ DParameter(
dri = parent.dri.copy(target = index + 1),
name = descriptor.name.asString(),
type = descriptor.type.toBound(),
@@ -352,28 +350,28 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
extra = descriptor.additionalExtras()
)
- private fun MemberScope.functions(parent: DRIWithPlatformInfo): List<Function> =
+ private fun MemberScope.functions(parent: DRIWithPlatformInfo): List<DFunction> =
getContributedDescriptors(DescriptorKindFilter.FUNCTIONS) { true }
.filterIsInstance<FunctionDescriptor>()
.map { visitFunctionDescriptor(it, parent) }
- private fun MemberScope.properties(parent: DRIWithPlatformInfo): List<Property> =
+ private fun MemberScope.properties(parent: DRIWithPlatformInfo): List<DProperty> =
getContributedDescriptors(DescriptorKindFilter.VALUES) { true }
.filterIsInstance<PropertyDescriptor>()
.map { visitPropertyDescriptor(it, parent) }
- private fun MemberScope.classlikes(parent: DRIWithPlatformInfo): List<Classlike> =
+ private fun MemberScope.classlikes(parent: DRIWithPlatformInfo): List<DClasslike> =
getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS) { true }
.filterIsInstance<ClassDescriptor>()
.map { visitClassDescriptor(it, parent) }
- .mapNotNull { it as? Classlike }
+ .mapNotNull { it as? DClasslike }
- private fun MemberScope.packages(parent: DRIWithPlatformInfo): List<Package> =
+ private fun MemberScope.packages(parent: DRIWithPlatformInfo): List<DPackage> =
getContributedDescriptors(DescriptorKindFilter.PACKAGES) { true }
.filterIsInstance<PackageFragmentDescriptor>()
.map { visitPackageFragmentDescriptor(it, parent) }
- private fun MemberScope.enumEntries(parent: DRIWithPlatformInfo): List<EnumEntry> =
+ private fun MemberScope.enumEntries(parent: DRIWithPlatformInfo): List<DEnumEntry> =
this.getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS) { true }
.filterIsInstance<ClassDescriptor>()
.filter { it.kind == ClassKind.ENUM_ENTRY }
@@ -391,7 +389,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
}
private fun TypeParameterDescriptor.toTypeParameter() =
- TypeParameter(
+ DTypeParameter(
DRI.from(this),
name.identifier,
PlatformDependent.from(platformData, getDocumentation()),
@@ -428,7 +426,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
MarkdownParser(resolutionFacade, this).parseFromKDocTag(it)
}
- fun ClassDescriptor.companion(dri: DRIWithPlatformInfo): Object? = companionObjectDescriptor?.let {
+ fun ClassDescriptor.companion(dri: DRIWithPlatformInfo): DObject? = companionObjectDescriptor?.let {
objectDescriptor(it, dri)
}
@@ -467,7 +465,7 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
ExtraModifiers.OVERRIDE.takeIf { getSuperInterfaces().isNotEmpty() || getSuperClassNotAny() != null }
).toContainer()
- fun ValueParameterDescriptor.additionalExtras(): PropertyContainer<Parameter> =
+ fun ValueParameterDescriptor.additionalExtras(): PropertyContainer<DParameter> =
listOfNotNull(
ExtraModifiers.DYNAMIC.takeIf { isDynamic() },
ExtraModifiers.NOINLINE.takeIf { isNoinline },
@@ -477,13 +475,13 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
ExtraModifiers.VARARG.takeIf { isVararg }
).toContainer()
- fun TypeParameterDescriptor.additionalExtras(): PropertyContainer<TypeParameter> =
+ fun TypeParameterDescriptor.additionalExtras(): PropertyContainer<DTypeParameter> =
listOfNotNull(
ExtraModifiers.DYNAMIC.takeIf { isDynamic() },
ExtraModifiers.REIFIED.takeIf { isReified }
).toContainer()
- fun PropertyDescriptor.additionalExtras(): PropertyContainer<Property> = listOfNotNull(
+ fun PropertyDescriptor.additionalExtras(): PropertyContainer<DProperty> = listOfNotNull(
ExtraModifiers.DYNAMIC.takeIf { isDynamic() },
ExtraModifiers.CONST.takeIf { isConst },
ExtraModifiers.LATEINIT.takeIf { isLateInit },
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultDocumentableToPageTranslator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultDocumentableToPageTranslator.kt
index 16f9b9b3..04251947 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultDocumentableToPageTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultDocumentableToPageTranslator.kt
@@ -2,7 +2,7 @@ package org.jetbrains.dokka.base.translators.documentables
import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
-import org.jetbrains.dokka.model.Module
+import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.ModulePageNode
import org.jetbrains.dokka.transformers.documentation.DocumentableToPageTranslator
import org.jetbrains.dokka.utilities.DokkaLogger
@@ -12,6 +12,6 @@ class DefaultDocumentableToPageTranslator(
private val signatureProvider: SignatureProvider,
private val logger: DokkaLogger
) : DocumentableToPageTranslator {
- override fun invoke(module: Module): ModulePageNode =
+ override fun invoke(module: DModule): ModulePageNode =
DefaultPageCreator(commentsToContentConverter, signatureProvider, logger).pageForModule(module)
} \ No newline at end of file
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
index 560bda71..a0b5a072 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
@@ -4,7 +4,7 @@ import org.jetbrains.dokka.base.signatures.SignatureProvider
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.model.doc.Property
import org.jetbrains.dokka.model.doc.TagWrapper
import org.jetbrains.dokka.pages.*
@@ -17,16 +17,16 @@ open class DefaultPageCreator(
) {
protected open val contentBuilder = PageContentBuilder(commentsToContentConverter, signatureProvider, logger)
- open fun pageForModule(m: Module) =
+ open fun pageForModule(m: DModule) =
ModulePageNode(m.name.ifEmpty { "<root>" }, contentForModule(m), m, m.packages.map(::pageForPackage))
- open fun pageForPackage(p: Package): PackagePageNode = PackagePageNode(
+ open fun pageForPackage(p: DPackage): PackagePageNode = PackagePageNode(
p.name, contentForPackage(p), setOf(p.dri), p,
p.classlikes.map(::pageForClasslike) +
p.functions.map(::pageForFunction)
)
- open fun pageForClasslike(c: Classlike): ClasslikePageNode {
+ open fun pageForClasslike(c: DClasslike): ClasslikePageNode {
val constructors = if (c is WithConstructors) c.constructors else emptyList()
return ClasslikePageNode(
@@ -37,9 +37,9 @@ open class DefaultPageCreator(
)
}
- open fun pageForFunction(f: Function) = MemberPageNode(f.name, contentForFunction(f), setOf(f.dri), f)
+ open fun pageForFunction(f: DFunction) = MemberPageNode(f.name, contentForFunction(f), setOf(f.dri), f)
- protected open fun contentForModule(m: Module) = contentBuilder.contentFor(m) {
+ protected open fun contentForModule(m: DModule) = contentBuilder.contentFor(m) {
header(1) { text(m.name) }
block("Packages", 2, ContentKind.Packages, m.packages, m.platformData.toSet()) {
link(it.name, it.dri)
@@ -48,7 +48,7 @@ open class DefaultPageCreator(
// text("Link to allpage here")
}
- protected open fun contentForPackage(p: Package) = contentBuilder.contentFor(p) {
+ protected open fun contentForPackage(p: DPackage) = contentBuilder.contentFor(p) {
header(1) { text("Package ${p.name}") }
+contentForScope(p, p.dri, p.platformData)
}
@@ -87,7 +87,7 @@ open class DefaultPageCreator(
}
}
- protected open fun contentForClasslike(c: Classlike) = contentBuilder.contentFor(c) {
+ protected open fun contentForClasslike(c: DClasslike) = contentBuilder.contentFor(c) {
header(1) { text(c.name.orEmpty()) }
+buildSignature(c)
@@ -126,7 +126,7 @@ open class DefaultPageCreator(
}
}.children
- protected open fun contentForFunction(f: Function) = contentBuilder.contentFor(f) {
+ protected open fun contentForFunction(f: DFunction) = contentBuilder.contentFor(f) {
header(1) { text(f.name) }
+buildSignature(f)
+contentForComments(f)
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index 65f94843..c5c72a65 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -9,9 +9,9 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.JavaClassReference
import org.jetbrains.dokka.links.withClass
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Annotation
-import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DAnnotation
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.PlatformData
import org.jetbrains.dokka.plugability.DokkaContext
@@ -31,17 +31,17 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
psiFiles: List<PsiJavaFile>,
platformData: PlatformData,
context: DokkaContext
- ): Module {
+ ): DModule {
val docParser =
DokkaPsiParser(
platformData,
context.logger
)
- return Module(
+ return DModule(
moduleName,
psiFiles.groupBy { it.packageName }.map { (packageName, psiFiles) ->
val dri = DRI(packageName = packageName)
- Package(
+ DPackage(
dri,
emptyList(),
emptyList(),
@@ -93,7 +93,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
private fun <T> T.toPlatformDependant() =
PlatformDependent(mapOf(platformData to this))
- fun parseClasslike(psi: PsiClass, parent: DRI): Classlike = with(psi) {
+ fun parseClasslike(psi: PsiClass, parent: DRI): DClasslike = with(psi) {
val dri = parent.withClass(name.toString())
val ancestorsSet = hashSetOf<DRI>()
val superMethodsKeys = hashSetOf<Int>()
@@ -133,7 +133,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
val ancestors = ancestorsSet.toList().toPlatformDependant()
return when {
isAnnotationType ->
- Annotation(
+ DAnnotation(
name.orEmpty(),
dri,
documentation,
@@ -146,11 +146,11 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
constructors.map { parseFunction(it, dri, true) },
listOf(platformData)
)
- isEnum -> Enum(
+ isEnum -> DEnum(
dri,
name.orEmpty(),
fields.filterIsInstance<PsiEnumConstant>().map { entry ->
- EnumEntry(
+ DEnumEntry(
dri.withClass("$name.${entry.name}"),
entry.name.orEmpty(),
javadocParser.parseDocumentation(entry).toPlatformDependant(),
@@ -171,7 +171,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
ancestors,
listOf(platformData)
)
- isInterface -> Interface(
+ isInterface -> DInterface(
dri,
name.orEmpty(),
documentation,
@@ -185,7 +185,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
ancestors,
listOf(platformData)
)
- else -> Class(
+ else -> DClass(
dri,
name.orEmpty(),
constructors.map { parseFunction(it, dri, true) },
@@ -209,7 +209,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
parent: DRI,
isConstructor: Boolean = false,
isInherited: Boolean = false
- ): Function {
+ ): DFunction {
val dri = parent.copy(
callable = Callable(
psi.name,
@@ -218,12 +218,12 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
JavaClassReference(parameter.type.canonicalText)
})
)
- return Function(
+ return DFunction(
dri,
if (isConstructor) "<init>" else psi.name,
isConstructor,
psi.parameterList.parameters.mapIndexed { index, psiParameter ->
- Parameter(
+ DParameter(
dri.copy(target = index + 1),
psiParameter.name,
javadocParser.parseDocumentation(psiParameter).toPlatformDependant(),
@@ -239,7 +239,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
null,
psi.getModifier(),
listOf(platformData),
- PropertyContainer.empty<Function>() + InheritedFunction(
+ PropertyContainer.empty<DFunction>() + InheritedFunction(
isInherited
)
)
@@ -278,7 +278,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
else -> JavaModifier.Empty
}
- private fun PsiTypeParameterListOwner.mapTypeParameters(dri: DRI): List<TypeParameter> {
+ private fun PsiTypeParameterListOwner.mapTypeParameters(dri: DRI): List<DTypeParameter> {
fun mapBounds(bounds: Array<JvmReferenceType>): List<Bound> =
if (bounds.isEmpty()) emptyList() else bounds.mapNotNull {
(it as? PsiClassType)?.let { classType ->
@@ -286,7 +286,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
}
}
return typeParameters.mapIndexed { index, type ->
- TypeParameter(
+ DTypeParameter(
dri.copy(genericTarget = index),
type.name.orEmpty(),
javadocParser.parseDocumentation(type).toPlatformDependant(),
@@ -323,7 +323,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
return regularMethods to accessors
}
- private fun parseField(psi: PsiField, parent: DRI, accessors: List<PsiMethod>): Property {
+ private fun parseField(psi: PsiField, parent: DRI, accessors: List<PsiMethod>): DProperty {
val dri = parent.copy(
callable = Callable(
psi.name!!, // TODO: Investigate if this is indeed nullable
@@ -331,7 +331,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator {
emptyList()
)
)
- return Property(
+ return DProperty(
dri,
psi.name!!, // TODO: Investigate if this is indeed nullable
javadocParser.parseDocumentation(psi).toPlatformDependant(),
diff --git a/plugins/base/src/test/kotlin/enums/EnumsTest.kt b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
index ea3238a5..34e92d82 100644
--- a/plugins/base/src/test/kotlin/enums/EnumsTest.kt
+++ b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
@@ -1,9 +1,8 @@
package enums
-import org.jetbrains.dokka.model.Enum
+import org.jetbrains.dokka.model.DEnum
import org.jetbrains.dokka.pages.ClasslikePageNode
import org.jetbrains.dokka.pages.ModulePageNode
-import org.junit.Assert
import org.junit.Assert.*
import org.junit.Test
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
@@ -72,7 +71,7 @@ class EnumsTest : AbstractCoreTest() {
p.first().classlikes.let { c ->
assertTrue("Classlikes list cannot be empty", c.isNotEmpty())
- val enum = c.first() as Enum
+ val enum = c.first() as DEnum
assertEquals(enum.name, "Test")
assertEquals(enum.entries.count(), 2)
assertNotNull(enum.companion)
diff --git a/plugins/base/src/test/kotlin/issues/IssuesTest.kt b/plugins/base/src/test/kotlin/issues/IssuesTest.kt
index ea2f0f8e..e34c610a 100644
--- a/plugins/base/src/test/kotlin/issues/IssuesTest.kt
+++ b/plugins/base/src/test/kotlin/issues/IssuesTest.kt
@@ -1,7 +1,7 @@
package issues
-import org.jetbrains.dokka.model.Class
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DClass
+import org.jetbrains.dokka.model.DFunction
import org.junit.Test
import utils.AbstractModelTest
@@ -33,16 +33,16 @@ class IssuesTest : AbstractModelTest("/src/main/kotlin/issues/Test.kt", "issues"
|}
"""
) {
- with((this / "issues" / "Test").cast<Class>()) {
+ with((this / "issues" / "Test").cast<DClass>()) {
// passes
- (this / "working").cast<Function>().type.constructorFqName equals "kotlin.String"
- (this / "doSomething").cast<Function>().type.constructorFqName equals "kotlin.String"
+ (this / "working").cast<DFunction>().type.constructorFqName equals "kotlin.String"
+ (this / "doSomething").cast<DFunction>().type.constructorFqName equals "kotlin.String"
// fails
- (this / "brokenGenerics").cast<Function>().type.constructorFqName equals "kotlin.collections.List"
- (this / "brokenApply").cast<Function>().type.constructorFqName equals "issues.Test"
- (this / "brokenRun").cast<Function>().type.constructorFqName equals "issues.Test"
- (this / "brokenLet").cast<Function>().type.constructorFqName equals "issues.Test"
+ (this / "brokenGenerics").cast<DFunction>().type.constructorFqName equals "kotlin.collections.List"
+ (this / "brokenApply").cast<DFunction>().type.constructorFqName equals "issues.Test"
+ (this / "brokenRun").cast<DFunction>().type.constructorFqName equals "issues.Test"
+ (this / "brokenLet").cast<DFunction>().type.constructorFqName equals "issues.Test"
}
}
}
diff --git a/plugins/base/src/test/kotlin/markdown/KDocTest.kt b/plugins/base/src/test/kotlin/markdown/KDocTest.kt
index e250670a..fa538c3e 100644
--- a/plugins/base/src/test/kotlin/markdown/KDocTest.kt
+++ b/plugins/base/src/test/kotlin/markdown/KDocTest.kt
@@ -1,6 +1,6 @@
package markdown
-import org.jetbrains.dokka.model.Package
+import org.jetbrains.dokka.model.DPackage
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.jetbrains.dokka.pages.ModulePageNode
import org.junit.Assert
@@ -26,7 +26,7 @@ open class KDocTest : AbstractCoreTest() {
""".trimMargin()
private fun actualDocumentationNode(modulePageNode: ModulePageNode) =
- (modulePageNode.documentable?.children?.first() as Package)
+ (modulePageNode.documentable?.children?.first() as DPackage)
.classlikes.single()
.documentation.values.single()
diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt
index a59174bf..d627dab4 100644
--- a/plugins/base/src/test/kotlin/model/ClassesTest.kt
+++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt
@@ -2,7 +2,7 @@ package model
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.KotlinModifier.*
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DFunction
import org.junit.Test
import utils.AbstractModelTest
import utils.assertNotNull
@@ -17,7 +17,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
"""
|class Klass {}"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
children counts 4
}
@@ -31,7 +31,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|object Obj {}
"""
) {
- with((this / "classes" / "Obj").cast<Object>()) {
+ with((this / "classes" / "Obj").cast<DObject>()) {
name equals "Obj"
children counts 3
}
@@ -45,7 +45,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|class Klass(name: String)
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
children counts 4
@@ -71,11 +71,11 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
children counts 5
- with((this / "fn").cast<Function>()) {
+ with((this / "fn").cast<DFunction>()) {
type.constructorFqName equals "kotlin.Unit"
parameters counts 0
visibility.values allEquals KotlinVisibility.Public
@@ -93,11 +93,11 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
children counts 5
- with((this / "name").cast<Property>()) {
+ with((this / "name").cast<DProperty>()) {
name equals "name"
// TODO property name
}
@@ -117,19 +117,19 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
children counts 5
- with((this / "Companion").cast<Object>()) {
+ with((this / "Companion").cast<DObject>()) {
name equals "Companion"
children counts 5
- with((this / "x").cast<Property>()) {
+ with((this / "x").cast<DProperty>()) {
name equals "x"
}
- with((this / "foo").cast<Function>()) {
+ with((this / "foo").cast<DFunction>()) {
name equals "foo"
parameters counts 0
type.constructorFqName equals "kotlin.Unit"
@@ -146,7 +146,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|data class Klass() {}
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
visibility.values allEquals KotlinVisibility.Public
with(extra[AdditionalModifiers.AdditionalKey].assertNotNull("Extras")) {
@@ -170,7 +170,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|sealed class Klass() {}
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
modifier equals KotlinModifier.Sealed
}
@@ -215,18 +215,18 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- val C = (this / "classes" / "C").cast<Class>()
- val D = (this / "classes" / "D").cast<Class>()
+ val C = (this / "classes" / "C").cast<DClass>()
+ val D = (this / "classes" / "D").cast<DClass>()
with(C) {
modifier equals Open
- with((this / "f").cast<Function>()) {
+ with((this / "f").cast<DFunction>()) {
modifier equals Open
}
}
with(D) {
modifier equals Final
- with((this / "f").cast<Function>()) {
+ with((this / "f").cast<DFunction>()) {
modifier equals Open
}
D.supertypes.flatMap { it.component2() }.firstOrNull() equals C.dri
@@ -249,13 +249,13 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- val C = (this / "classes" / "C").cast<Class>()
- val D = (this / "classes" / "D").cast<Class>()
- val E = (this / "classes" / "E").cast<Class>()
+ val C = (this / "classes" / "C").cast<DClass>()
+ val D = (this / "classes" / "D").cast<DClass>()
+ val E = (this / "classes" / "E").cast<DClass>()
with(C) {
modifier equals Abstract
- ((this / "foo").cast<Function>()).modifier equals Abstract
+ ((this / "foo").cast<DFunction>()).modifier equals Abstract
}
with(D) {
@@ -280,9 +280,9 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- with((this / "classes" / "C").cast<Class>()) {
+ with((this / "classes" / "C").cast<DClass>()) {
- with((this / "D").cast<Class>()) {
+ with((this / "D").cast<DClass>()) {
}
}
}
@@ -312,10 +312,10 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|val Klass.Default.x: Int get() = 1
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
- with((this / "Default").cast<Object>()) {
+ with((this / "Default").cast<DObject>()) {
name equals "Default"
// TODO extensions
}
@@ -342,7 +342,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- with((this / "classes" / "C").cast<Class>()) {
+ with((this / "classes" / "C").cast<DClass>()) {
name equals "C"
constructors counts 2
@@ -384,14 +384,14 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
|}
"""
) {
- with((this / "classes" / "Klass").cast<Class>()) {
+ with((this / "classes" / "Klass").cast<DClass>()) {
name equals "Klass"
- with((this / "Companion").cast<Object>()) {
+ with((this / "Companion").cast<DObject>()) {
name equals "Companion"
visibility.values allEquals KotlinVisibility.Private
- with((this / "fn").cast<Function>()) {
+ with((this / "fn").cast<DFunction>()) {
name equals "fn"
parameters counts 0
receiver equals null
diff --git a/plugins/base/src/test/kotlin/model/CommentTest.kt b/plugins/base/src/test/kotlin/model/CommentTest.kt
index d576cf49..055892af 100644
--- a/plugins/base/src/test/kotlin/model/CommentTest.kt
+++ b/plugins/base/src/test/kotlin/model/CommentTest.kt
@@ -1,6 +1,6 @@
package model
-import org.jetbrains.dokka.model.Property
+import org.jetbrains.dokka.model.DProperty
import org.jetbrains.dokka.model.doc.CustomWrapperTag
import org.jetbrains.dokka.model.doc.Text
import org.junit.Test
@@ -28,7 +28,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val prop2 = ""
"""
) {
- with((this / "comment" / "prop1").cast<Property>()) {
+ with((this / "comment" / "prop1").cast<DProperty>()) {
name equals "prop1"
with(this.docs().firstOrNull()?.root.assertNotNull("Code")) {
(children.firstOrNull() as? Text)
@@ -37,7 +37,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
params["lang"] equals "brainfuck"
}
}
- with((this / "comment" / "prop2").cast<Property>()) {
+ with((this / "comment" / "prop2").cast<DProperty>()) {
name equals "prop2"
comments() equals "a + b - c"
}
@@ -51,7 +51,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
name equals "property"
comments() equals ""
}
@@ -68,7 +68,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
"""
) {
val p = this
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals ""
}
}
@@ -87,7 +87,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "doc1\ndoc2 doc3"
}
}
@@ -107,7 +107,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "doc1\ndoc2 doc3"
}
}
@@ -121,7 +121,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "doc"
}
}
@@ -136,7 +136,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "doc"
}
}
@@ -151,7 +151,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "doc"
}
}
@@ -168,7 +168,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "Summary\none: []"
docs().find { it is CustomWrapperTag && it.name == "one" }.let {
with(it.assertNotNull("'one' entry")) {
@@ -188,7 +188,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals """it's "useful""""
}
}
@@ -205,7 +205,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "Summary\none: [section one]"
}
}
@@ -224,7 +224,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "Summary\none: [section one]\ntwo: [section two]"
}
}
@@ -243,7 +243,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|val property = "test"
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
comments() equals "Summary\none: [line one line two]"
}
}
@@ -290,7 +290,7 @@ class CommentTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comme
|}
"""
) {
- with((this / "comment" / "property").cast<Property>()) {
+ with((this / "comment" / "property").cast<DProperty>()) {
this
}
}
diff --git a/plugins/base/src/test/kotlin/model/FunctionsTest.kt b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
index 9554ad02..f3a7adc7 100644
--- a/plugins/base/src/test/kotlin/model/FunctionsTest.kt
+++ b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
@@ -1,7 +1,7 @@
package model
-import org.jetbrains.dokka.model.Function
-import org.jetbrains.dokka.model.Package
+import org.jetbrains.dokka.model.DFunction
+import org.jetbrains.dokka.model.DPackage
import org.junit.Test
import utils.*
@@ -17,7 +17,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
|fun fn() {}
"""
) {
- with((this / "function" / "fn").cast<Function>()) {
+ with((this / "function" / "fn").cast<DFunction>()) {
name equals "fn"
type.constructorFqName equals "kotlin.Unit"
this.children.assertCount(0, "Function children: ")
@@ -39,7 +39,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
|fun fn(i: Int) {}
"""
) {
- with((this / "function").cast<Package>()) {
+ with((this / "function").cast<DPackage>()) {
val fn1 = functions.find {
it.name == "fn" && it.parameters.isNullOrEmpty()
}.assertNotNull("fn()")
@@ -76,7 +76,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
|fun String.fn(x: Int) {}
"""
) {
- with((this / "function").cast<Package>()) {
+ with((this / "function").cast<DPackage>()) {
val fn1 = functions.find {
it.name == "fn" && it.parameters.isNullOrEmpty()
}.assertNotNull("fn()")
@@ -114,7 +114,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
|}
"""
) {
- with((this / "function" / "function").cast<Function>()) {
+ with((this / "function" / "function").cast<DFunction>()) {
comments() equals "Multiline\nFunction Documentation"
name equals "function"
@@ -141,7 +141,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
) {
// TODO add annotations
- with((this / "function" / "f").cast<Function>()) {
+ with((this / "function" / "f").cast<DFunction>()) {
assert(false) { "No annotation data" }
}
}
@@ -162,7 +162,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
) {
// TODO add data about inline
- with((this / "function" / "f").cast<Function>()) {
+ with((this / "function" / "f").cast<DFunction>()) {
assert(false) { "No inline data" }
}
}
@@ -184,7 +184,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
) {
// TODO add data about suspend
- with((this / "function" / "f").cast<Function>()) {
+ with((this / "function" / "f").cast<DFunction>()) {
assert(false) { "No suspend data" }
}
}
diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt
index ea454763..c2545e7a 100644
--- a/plugins/base/src/test/kotlin/model/JavaTest.kt
+++ b/plugins/base/src/test/kotlin/model/JavaTest.kt
@@ -1,8 +1,8 @@
package model
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DFunction
import org.junit.Assert.assertTrue
import org.junit.Test
import utils.AbstractModelTest
@@ -24,10 +24,10 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Test").cast<Class>()) {
+ with((this / "java" / "Test").cast<DClass>()) {
name equals "Test"
children counts 1
- with((this / "fn").cast<Function>()) {
+ with((this / "fn").cast<DFunction>()) {
name equals "fn"
this
}
@@ -82,7 +82,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Test" / "fn").cast<Function>()) {
+ with((this / "java" / "Test" / "fn").cast<DFunction>()) {
this
}
}
@@ -108,7 +108,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|public class Foo extends Exception implements Cloneable {}
"""
) {
- with((this / "java" / "Foo").cast<Class>()) {
+ with((this / "java" / "Foo").cast<DClass>()) {
val sups = listOf("Exception", "Cloneable")
assertTrue(
"Foo must extend ${sups.joinToString(", ")}",
@@ -128,11 +128,11 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Test").cast<Class>()) {
+ with((this / "java" / "Test").cast<DClass>()) {
name equals "Test"
children counts 1
- with((this / "arrayToString").cast<Function>()) {
+ with((this / "arrayToString").cast<DFunction>()) {
name equals "arrayToString"
type.constructorFqName equals "java.lang.String[]"
with(parameters.firstOrNull().assertNotNull("parameters")) {
@@ -153,7 +153,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Foo").cast<Class>()) {
+ with((this / "java" / "Foo").cast<DClass>()) {
this
}
}
@@ -189,7 +189,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Test").cast<Class>()) {
+ with((this / "java" / "Test").cast<DClass>()) {
name equals "Test"
constructors counts 2
@@ -211,9 +211,9 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "InnerClass").cast<Class>()) {
+ with((this / "java" / "InnerClass").cast<DClass>()) {
children counts 1
- with((this / "D").cast<Class>()) {
+ with((this / "D").cast<DClass>()) {
name equals "D"
children counts 0
}
@@ -230,11 +230,11 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Foo").cast<Class>()) {
+ with((this / "java" / "Foo").cast<DClass>()) {
name equals "Foo"
children counts 1
- with((this / "bar").cast<Function>()) {
+ with((this / "bar").cast<DFunction>()) {
name equals "bar"
with(parameters.firstOrNull().assertNotNull("parameter")) {
name equals "x"
@@ -255,15 +255,15 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "Test").cast<Class>()) {
+ with((this / "java" / "Test").cast<DClass>()) {
children counts 2
- with((this / "i").cast<Property>()) {
+ with((this / "i").cast<DProperty>()) {
getter.assertNotNull("i.get")
setter.assertNotNull("i.set")
}
- with((this / "s").cast<Property>()) {
+ with((this / "s").cast<DProperty>()) {
getter.assertNotNull("s.get")
setter.assertNotNull("s.set")
@@ -344,11 +344,11 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
|}
"""
) {
- with((this / "java" / "E").cast<Enum>()) {
+ with((this / "java" / "E").cast<DEnum>()) {
name equals "E"
entries counts 1
- with((this / "Foo").cast<EnumEntry>()) {
+ with((this / "Foo").cast<DEnumEntry>()) {
name equals "Foo"
}
}
diff --git a/plugins/base/src/test/kotlin/model/PackagesTest.kt b/plugins/base/src/test/kotlin/model/PackagesTest.kt
index e19cc82d..008ae14d 100644
--- a/plugins/base/src/test/kotlin/model/PackagesTest.kt
+++ b/plugins/base/src/test/kotlin/model/PackagesTest.kt
@@ -1,6 +1,6 @@
package model
-import org.jetbrains.dokka.model.Package
+import org.jetbrains.dokka.model.DPackage
import org.junit.Test
import utils.AbstractModelTest
@@ -14,7 +14,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
""".trimIndent(),
prependPackage = false
) {
- with((this / "").cast<Package>()) {
+ with((this / "").cast<DPackage>()) {
name equals ""
children counts 0
}
@@ -29,7 +29,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
""".trimIndent(),
prependPackage = false
) {
- with((this / "simple").cast<Package>()) {
+ with((this / "simple").cast<DPackage>()) {
name equals "simple"
children counts 0
}
@@ -44,7 +44,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
""".trimIndent(),
prependPackage = false
) {
- with((this / "dot.name").cast<Package>()) {
+ with((this / "dot.name").cast<DPackage>()) {
name equals "dot.name"
children counts 0
}
@@ -63,11 +63,11 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
prependPackage = false
) {
children counts 2
- with((this / "dot.name").cast<Package>()) {
+ with((this / "dot.name").cast<DPackage>()) {
name equals "dot.name"
children counts 0
}
- with((this / "simple").cast<Package>()) {
+ with((this / "simple").cast<DPackage>()) {
name equals "simple"
children counts 0
}
@@ -85,7 +85,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
prependPackage = false
) {
children counts 1
- with((this / "simple").cast<Package>()) {
+ with((this / "simple").cast<DPackage>()) {
name equals "simple"
children counts 0
}
@@ -102,7 +102,7 @@ class PackagesTest : AbstractModelTest("/src/main/kotlin/packages/Test.kt", "pac
""".trimIndent(),
prependPackage = false
) {
- with((this / "simple.name").cast<Package>()) {
+ with((this / "simple.name").cast<DPackage>()) {
name equals "simple.name"
children counts 1
}
diff --git a/plugins/base/src/test/kotlin/model/PropertyTest.kt b/plugins/base/src/test/kotlin/model/PropertyTest.kt
index e4ef0aec..d12e292b 100644
--- a/plugins/base/src/test/kotlin/model/PropertyTest.kt
+++ b/plugins/base/src/test/kotlin/model/PropertyTest.kt
@@ -1,8 +1,8 @@
package model
import org.jetbrains.dokka.model.KotlinVisibility
-import org.jetbrains.dokka.model.Package
-import org.jetbrains.dokka.model.Property
+import org.jetbrains.dokka.model.DPackage
+import org.jetbrains.dokka.model.DProperty
import org.junit.Test
import utils.AbstractModelTest
import utils.assertNotNull
@@ -15,7 +15,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
"""
|val property = "test""""
) {
- with((this / "property" / "property").cast<Property>()) {
+ with((this / "property" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
with(getter.assertNotNull("Getter")) {
@@ -33,7 +33,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
|var property = "test"
"""
) {
- with((this / "property" / "property").cast<Property>()) {
+ with((this / "property" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
setter.assertNotNull("Setter")
@@ -53,7 +53,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
| get() = "test"
"""
) {
- with((this / "property" / "property").cast<Property>()) {
+ with((this / "property" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
with(getter.assertNotNull("Getter")) {
@@ -73,7 +73,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
| set(value) {}
"""
) {
- with((this / "property" / "property").cast<Property>()) {
+ with((this / "property" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
setter.assertNotNull("Setter")
@@ -93,7 +93,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
| get() = size() * 2
"""
) {
- with((this / "property" / "property").cast<Property>()) {
+ with((this / "property" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
with(receiver.assertNotNull("property receiver")) {
@@ -120,15 +120,15 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro
|}
"""
) {
- with((this / "property").cast<Package>()) {
- with((this / "Foo" / "property").cast<Property>()) {
+ with((this / "property").cast<DPackage>()) {
+ with((this / "Foo" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
with(getter.assertNotNull("Getter")) {
type.constructorFqName equals "kotlin.Int"
}
}
- with((this / "Bar" / "property").cast<Property>()) {
+ with((this / "Bar" / "property").cast<DProperty>()) {
name equals "property"
children counts 0
with(getter.assertNotNull("Getter")) {
diff --git a/plugins/base/src/test/kotlin/utils/ModelUtils.kt b/plugins/base/src/test/kotlin/utils/ModelUtils.kt
index 75c8e008..1e6f64c6 100644
--- a/plugins/base/src/test/kotlin/utils/ModelUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/ModelUtils.kt
@@ -1,8 +1,6 @@
package utils
-import org.jetbrains.dokka.model.Module
-import org.jetbrains.dokka.model.doc.DocumentationNode
-import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
+import org.jetbrains.dokka.model.DModule
abstract class AbstractModelTest(val path: String? = null, val pkg: String) : ModelDSL(), AssertDSL {
@@ -11,7 +9,7 @@ abstract class AbstractModelTest(val path: String? = null, val pkg: String) : Mo
platform: String = "jvm",
targetList: List<String> = listOf("jvm"),
prependPackage: Boolean = true,
- block: Module.() -> Unit
+ block: DModule.() -> Unit
) {
val configuration = dokkaConfiguration {
passes {
diff --git a/plugins/base/src/test/kotlin/utils/TestUtils.kt b/plugins/base/src/test/kotlin/utils/TestUtils.kt
index 6913ba5b..bf86c1b1 100644
--- a/plugins/base/src/test/kotlin/utils/TestUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/TestUtils.kt
@@ -1,13 +1,9 @@
package utils
-import org.jetbrains.dokka.model.Class
+import org.jetbrains.dokka.model.DClass
import org.jetbrains.dokka.model.Documentable
-import org.jetbrains.dokka.model.Function
-import org.jetbrains.dokka.model.Property
import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
-import kotlin.reflect.KClass
-import kotlin.reflect.full.safeCast
@DslMarker
annotation class TestDSL
@@ -64,5 +60,5 @@ fun <T> T?.assertNotNull(name: String = ""): T = this ?: throw AssertionError("$
fun <T : Documentable> T?.docs() = this?.documentation.orEmpty().values.flatMap { it.children }
-val Class.supers
+val DClass.supers
get() = supertypes.flatMap{it.component2()} \ No newline at end of file
diff --git a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt
index cf777e67..991ee07d 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt
@@ -4,9 +4,9 @@ import org.jetbrains.dokka.links.Callable
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.withClass
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Annotation
-import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DAnnotation
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
import org.jetbrains.kotlin.name.ClassId
@@ -21,21 +21,21 @@ private fun <T : WithExpectActual> List<T>.groupedByLocation() =
} // TODO: first() does not look reasonable
}) { it.second }
-internal fun Package.asJava(): Package {
+internal fun DPackage.asJava(): DPackage {
@Suppress("UNCHECKED_CAST")
val syntheticClasses = ((properties + functions) as List<WithExpectActual>)
.groupedByLocation()
.map { (syntheticClassName, nodes) ->
- Class(
+ DClass(
dri = dri.withClass(syntheticClassName),
name = syntheticClassName,
- properties = nodes.filterIsInstance<Property>().map { it.asJava() },
+ properties = nodes.filterIsInstance<DProperty>().map { it.asJava() },
constructors = emptyList(),
functions = (
- nodes.filterIsInstance<Property>()
+ nodes.filterIsInstance<DProperty>()
.map { it.javaAccessors() } +
- nodes.filterIsInstance<Function>()
- .map { it.asJava(syntheticClassName) }) as List<Function>, // TODO: methods are static and receiver is a param
+ nodes.filterIsInstance<DFunction>()
+ .map { it.asJava(syntheticClassName) }) as List<DFunction>, // TODO: methods are static and receiver is a param
classlikes = emptyList(),
sources = PlatformDependent.empty(),
visibility = PlatformDependent(
@@ -60,7 +60,7 @@ internal fun Package.asJava(): Package {
)
}
-internal fun Property.asJava(isTopLevel: Boolean = false, relocateToClass: String? = null) =
+internal fun DProperty.asJava(isTopLevel: Boolean = false, relocateToClass: String? = null) =
copy(
dri = if (relocateToClass.isNullOrBlank()) {
dri
@@ -81,7 +81,7 @@ internal fun Property.asJava(isTopLevel: Boolean = false, relocateToClass: Strin
extra = if (isTopLevel) extra.plus(extra.mergeAdditionalModifiers(setOf(ExtraModifiers.STATIC))) else extra
)
-internal fun Property.javaAccessors(isTopLevel: Boolean = false, relocateToClass: String? = null): List<Function> =
+internal fun DProperty.javaAccessors(isTopLevel: Boolean = false, relocateToClass: String? = null): List<DFunction> =
listOfNotNull(
getter?.copy(
dri = if (relocateToClass.isNullOrBlank()) {
@@ -122,7 +122,7 @@ internal fun Property.javaAccessors(isTopLevel: Boolean = false, relocateToClass
)
-internal fun Function.asJava(containingClassName: String): Function {
+internal fun DFunction.asJava(containingClassName: String): DFunction {
val newName = when {
isConstructor -> containingClassName
else -> name
@@ -137,16 +137,16 @@ internal fun Function.asJava(containingClassName: String): Function {
) // TODO static if toplevel
}
-internal fun Classlike.asJava(): Classlike = when (this) {
- is Class -> asJava()
- is Enum -> asJava()
- is Annotation -> asJava()
- is Object -> asJava()
- is Interface -> asJava()
+internal fun DClasslike.asJava(): DClasslike = when (this) {
+ is DClass -> asJava()
+ is DEnum -> asJava()
+ is DAnnotation -> asJava()
+ is DObject -> asJava()
+ is DInterface -> asJava()
else -> throw IllegalArgumentException("$this shouldn't be here")
}
-internal fun Class.asJava(): Class = copy(
+internal fun DClass.asJava(): DClass = copy(
constructors = constructors.map { it.asJava(name) },
functions = (functions + properties.map { it.getter } + properties.map { it.setter }).filterNotNull().map {
it.asJava(name)
@@ -160,7 +160,7 @@ internal fun Class.asJava(): Class = copy(
modifier = if (modifier is KotlinModifier.Empty) JavaModifier.Final else modifier
)
-private fun TypeParameter.asJava(): TypeParameter = copy(
+private fun DTypeParameter.asJava(): DTypeParameter = copy(
dri = dri.possiblyAsJava(),
bounds = bounds.map { it.asJava() }
)
@@ -175,7 +175,7 @@ private fun Bound.asJava(): Bound = when (this) {
else -> this
}
-internal fun Enum.asJava(): Enum = copy(
+internal fun DEnum.asJava(): DEnum = copy(
constructors = constructors.map { it.asJava(name) },
functions = (functions + properties.map { it.getter } + properties.map { it.setter }).filterNotNull().map {
it.asJava(name)
@@ -188,12 +188,12 @@ internal fun Enum.asJava(): Enum = copy(
// , entries = entries.map { it.asJava() }
)
-internal fun Object.asJava(): Object = copy(
+internal fun DObject.asJava(): DObject = copy(
functions = (functions + properties.map { it.getter } + properties.map { it.setter })
.filterNotNull()
.map { it.asJava(name.orEmpty()) },
properties = properties.map { it.asJava() } +
- Property(
+ DProperty(
name = "INSTANCE",
modifier = JavaModifier.Final,
dri = dri.copy(callable = Callable("INSTANCE", null, emptyList())),
@@ -209,7 +209,7 @@ internal fun Object.asJava(): Object = copy(
getter = null,
platformData = platformData,
receiver = null,
- extra = PropertyContainer.empty<Property>() + AdditionalModifiers(setOf(ExtraModifiers.STATIC))
+ extra = PropertyContainer.empty<DProperty>() + AdditionalModifiers(setOf(ExtraModifiers.STATIC))
),
classlikes = classlikes.map { it.asJava() },
supertypes = supertypes.copy(
@@ -217,7 +217,7 @@ internal fun Object.asJava(): Object = copy(
)
)
-internal fun Interface.asJava(): Interface = copy(
+internal fun DInterface.asJava(): DInterface = copy(
functions = (functions + properties.map { it.getter } + properties.map { it.setter })
.filterNotNull()
.map { it.asJava(name) },
@@ -229,13 +229,13 @@ internal fun Interface.asJava(): Interface = copy(
)
)
-internal fun Annotation.asJava(): Annotation = copy(
+internal fun DAnnotation.asJava(): DAnnotation = copy(
properties = properties.map { it.asJava() },
constructors = emptyList(),
classlikes = classlikes.map { it.asJava() }
) // TODO investigate if annotation class can have methods and properties not from constructor
-internal fun Parameter.asJava(): Parameter = copy(
+internal fun DParameter.asJava(): DParameter = copy(
type = type.asJava(),
name = if (name.isNullOrBlank()) "\$self" else name
)
diff --git a/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt b/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt
index 55dd7a97..0ec7d0af 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt
@@ -5,9 +5,9 @@ import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentCon
import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
import org.jetbrains.dokka.links.sureClassNames
import org.jetbrains.dokka.model.*
-import org.jetbrains.dokka.model.Annotation
-import org.jetbrains.dokka.model.Enum
-import org.jetbrains.dokka.model.Function
+import org.jetbrains.dokka.model.DAnnotation
+import org.jetbrains.dokka.model.DEnum
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.pages.ContentKind
import org.jetbrains.dokka.pages.ContentNode
import org.jetbrains.dokka.pages.TextStyle
@@ -22,28 +22,28 @@ class JavaSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLogge
override fun signature(documentable: Documentable): ContentNode = when (documentable) {
- is Function -> signature(documentable)
- is Property -> signature(documentable)
- is Classlike -> signature(documentable)
- is TypeParameter -> signature(documentable)
+ is DFunction -> signature(documentable)
+ is DProperty -> signature(documentable)
+ is DClasslike -> signature(documentable)
+ is DTypeParameter -> signature(documentable)
else -> throw NotImplementedError(
"Cannot generate signature for ${documentable::class.qualifiedName} ${documentable.name}"
)
}
- private fun signature(c: Classlike) = contentBuilder.contentFor(c, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
+ private fun signature(c: DClasslike) = contentBuilder.contentFor(c, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
platformText(c.visibility) { (it.takeIf { it !in ignoredVisibilities }?.name ?: "") + " " }
- if (c is Class) {
+ if (c is DClass) {
text(c.modifier.takeIf { it !in ignoredModifiers }?.name.orEmpty() + " ")
}
when (c) {
- is Class -> text("class ")
- is Interface -> text("interface ")
- is Enum -> text("enum ")
- is Object -> text("class ")
- is Annotation -> text("@interface ")
+ is DClass -> text("class ")
+ is DInterface -> text("interface ")
+ is DEnum -> text("enum ")
+ is DObject -> text("class ")
+ is DAnnotation -> text("@interface ")
}
link(c.name!!, c.dri)
if (c is WithGenerics) {
@@ -60,11 +60,11 @@ class JavaSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLogge
}
}
- private fun signature(p: Property) = contentBuilder.contentFor(p, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
+ private fun signature(p: DProperty) = contentBuilder.contentFor(p, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
signatureForProjection(p.type)
}
- private fun signature(f: Function) = contentBuilder.contentFor(f, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
+ private fun signature(f: DFunction) = contentBuilder.contentFor(f, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
text(f.modifier.takeIf { it !in ignoredModifiers }?.name.orEmpty() + " ")
val returnType = f.type
signatureForProjection(returnType)
@@ -82,7 +82,7 @@ class JavaSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLogge
text(")")
}
- private fun signature(t: TypeParameter) = contentBuilder.contentFor(t) {
+ private fun signature(t: DTypeParameter) = contentBuilder.contentFor(t) {
text(t.name.substringAfterLast("."))
list(t.bounds, prefix = " extends ") {
signatureForProjection(it)
diff --git a/plugins/kotlin-as-java/src/main/kotlin/transformers/KotlinAsJavaDocumentableTransformer.kt b/plugins/kotlin-as-java/src/main/kotlin/transformers/KotlinAsJavaDocumentableTransformer.kt
index 8f51e105..8b07670f 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/transformers/KotlinAsJavaDocumentableTransformer.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/transformers/KotlinAsJavaDocumentableTransformer.kt
@@ -1,11 +1,11 @@
package org.jetbrains.dokka.kotlinAsJava.transformers
import org.jetbrains.dokka.kotlinAsJava.converters.asJava
-import org.jetbrains.dokka.model.Module
+import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.transformers.documentation.DocumentableTransformer
class KotlinAsJavaDocumentableTransformer : DocumentableTransformer {
- override fun invoke(original: Module, context: DokkaContext): Module =
+ override fun invoke(original: DModule, context: DokkaContext): DModule =
original.copy(packages = original.packages.map { it.asJava() })
}
diff --git a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt
index 641cc5f9..a0e3b709 100644
--- a/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt
+++ b/testApi/src/main/kotlin/testApi/testRunner/TestRunner.kt
@@ -1,7 +1,7 @@
package org.jetbrains.dokka.testApi.testRunner
import org.jetbrains.dokka.*
-import org.jetbrains.dokka.model.Module
+import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.ModulePageNode
import org.jetbrains.dokka.pages.PlatformData
import org.jetbrains.dokka.pages.RootPageNode
@@ -104,9 +104,9 @@ abstract class AbstractCoreTest {
protected class TestBuilder {
var analysisSetupStage: (Map<PlatformData, EnvironmentAndFacade>) -> Unit = {}
var pluginsSetupStage: (DokkaContext) -> Unit = {}
- var documentablesCreationStage: (List<Module>) -> Unit = {}
- var documentablesMergingStage: (Module) -> Unit = {}
- var documentablesTransformationStage: (Module) -> Unit = {}
+ var documentablesCreationStage: (List<DModule>) -> Unit = {}
+ var documentablesMergingStage: (DModule) -> Unit = {}
+ var documentablesTransformationStage: (DModule) -> Unit = {}
var pagesGenerationStage: (ModulePageNode) -> Unit = {}
var pagesTransformationStage: (RootPageNode) -> Unit = {}
var renderingStage: (RootPageNode, DokkaContext) -> Unit = { a, b -> }
@@ -216,9 +216,9 @@ abstract class AbstractCoreTest {
data class TestMethods(
val analysisSetupStage: (Map<PlatformData, EnvironmentAndFacade>) -> Unit,
val pluginsSetupStage: (DokkaContext) -> Unit,
- val documentablesCreationStage: (List<Module>) -> Unit,
- val documentablesMergingStage: (Module) -> Unit,
- val documentablesTransformationStage: (Module) -> Unit,
+ val documentablesCreationStage: (List<DModule>) -> Unit,
+ val documentablesMergingStage: (DModule) -> Unit,
+ val documentablesTransformationStage: (DModule) -> Unit,
val pagesGenerationStage: (ModulePageNode) -> Unit,
val pagesTransformationStage: (RootPageNode) -> Unit,
val renderingStage: (RootPageNode, DokkaContext) -> Unit