aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main')
-rw-r--r--plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt16
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt3
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt1
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt21
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt10
5 files changed, 32 insertions, 19 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
index 3836f45d..617af959 100644
--- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
+++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
@@ -2,11 +2,10 @@ package org.jetbrains.dokka.base.signatures
import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter
import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
-import org.jetbrains.dokka.links.DRI
-import org.jetbrains.dokka.links.DriOfAny
-import org.jetbrains.dokka.links.DriOfUnit
-import org.jetbrains.dokka.links.sureClassNames
+import org.jetbrains.dokka.links.*
import org.jetbrains.dokka.model.*
+import org.jetbrains.dokka.model.Nullable
+import org.jetbrains.dokka.model.TypeConstructor
import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.jetbrains.dokka.pages.ContentKind
import org.jetbrains.dokka.pages.ContentNode
@@ -71,6 +70,11 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
is DAnnotation -> text("annotation class ")
}
link(c.name!!, c.dri)
+ if(c is WithGenerics){
+ list(c.generics, prefix = "<", suffix = "> ") {
+ +buildSignature(it)
+ }
+ }
if (c is DClass) {
val pConstructor = c.constructors.singleOrNull { it.extra[PrimaryConstructorExtra] != null }
list(pConstructor?.parameters.orEmpty(), "(", ")", ",", pConstructor?.sourceSets.orEmpty().toSet()) {
@@ -158,7 +162,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
}
private fun signature(t: DTypeParameter) = contentBuilder.contentFor(t) {
- link(t.name, t.dri)
+ link(t.name, t.dri.withTargetToDeclaration())
list(t.bounds, prefix = " : ") {
signatureForProjection(it)
}
@@ -166,7 +170,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
private fun PageContentBuilder.DocumentableContentBuilder.signatureForProjection(p: Projection): Unit =
when (p) {
- is OtherParameter -> text(p.name)
+ is OtherParameter -> link(p.name, p.declarationDRI)
is TypeConstructor -> if (p.function)
+funType(mainDRI.single(), mainPlatformData, p)
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
index 862f9240..1b8fa299 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentableMerger.kt
@@ -175,7 +175,8 @@ fun DAnnotation.mergeWith(other: DAnnotation): DAnnotation = copy(
expectPresentInSet = expectPresentInSet ?: other.expectPresentInSet,
sources = sources+ other.sources,
visibility = visibility + other.visibility,
- sourceSets = sourceSets + other.sourceSets
+ sourceSets = sourceSets + other.sourceSets,
+ generics = merge(generics + other.generics, DTypeParameter::mergeWith)
).mergeExtras(this, other)
fun DParameter.mergeWith(other: DParameter): DParameter = copy(
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt
index 6fdce3a8..d15ec791 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt
@@ -265,6 +265,7 @@ internal class DocumentableVisibilityFilter(val context: DokkaContext) : PreMerg
visibility.filtered(filteredPlatforms),
companion,
constructors,
+ generics,
filteredPlatforms,
extra
)
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index 7cc96a24..a62d9a0b 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -1,10 +1,11 @@
package org.jetbrains.dokka.base.translators.descriptors
import org.jetbrains.dokka.analysis.DokkaResolutionFacade
+import org.jetbrains.dokka.links.*
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.Nullable
+import org.jetbrains.dokka.model.TypeConstructor
import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.parsers.MarkdownParser
@@ -127,7 +128,7 @@ private class DokkaDescriptorVisitor(
visibility = descriptor.visibility.toDokkaVisibility().toSourceSetDependent(),
supertypes = info.supertypes.toSourceSetDependent(),
documentation = info.docs,
- generics = descriptor.typeConstructor.parameters.map { it.toTypeParameter() },
+ generics = descriptor.declaredTypeParameters.map { it.toTypeParameter() },
companion = descriptor.companion(driWithPlatform),
sourceSets = listOf(sourceSet),
extra = PropertyContainer.withAll(descriptor.additionalExtras(), descriptor.getAnnotations())
@@ -216,6 +217,7 @@ private class DokkaDescriptorVisitor(
extra = PropertyContainer.withAll(descriptor.additionalExtras(), descriptor.getAnnotations()),
companion = descriptor.companionObjectDescriptor?.let { objectDescriptor(it, driWithPlatform) },
visibility = descriptor.visibility.toDokkaVisibility().toSourceSetDependent(),
+ generics = descriptor.declaredTypeParameters.map { it.toTypeParameter() },
constructors = descriptor.constructors.map { visitConstructorDescriptor(it, driWithPlatform) },
sources = descriptor.createSources()
)
@@ -245,7 +247,7 @@ private class DokkaDescriptorVisitor(
expectPresentInSet = sourceSet.takeIf { isExpect },
visibility = descriptor.visibility.toDokkaVisibility().toSourceSetDependent(),
supertypes = info.supertypes.toSourceSetDependent(),
- generics = descriptor.typeConstructor.parameters.map { it.toTypeParameter() },
+ generics = descriptor.declaredTypeParameters.map { it.toTypeParameter() },
documentation = info.docs,
modifier = descriptor.modifier().toSourceSetDependent(),
companion = descriptor.companion(driWithPlatform),
@@ -364,7 +366,7 @@ private class DokkaDescriptorVisitor(
descriptor: ReceiverParameterDescriptor,
parent: DRIWithPlatformInfo
) = DParameter(
- dri = parent.dri.copy(target = 0),
+ dri = parent.dri.copy(target = PointingToDeclaration),
name = null,
type = descriptor.type.toBound(),
expectPresentInSet = null,
@@ -383,7 +385,7 @@ private class DokkaDescriptorVisitor(
fun PropertyDescriptor.asParameter(parent: DRI) =
DParameter(
- parent.copy(target = 1),
+ parent.copy(target = PointingToCallableParameters(parameterIndex = 1)),
this.name.asString(),
type = this.type.toBound(),
expectPresentInSet = sourceSet.takeIf { isExpect },
@@ -444,7 +446,7 @@ private class DokkaDescriptorVisitor(
private fun parameter(index: Int, descriptor: ValueParameterDescriptor, parent: DRIWithPlatformInfo) =
DParameter(
- dri = parent.dri.copy(target = index + 1),
+ dri = parent.dri.copy(target = PointingToCallableParameters(index)),
name = descriptor.name.asString(),
type = descriptor.type.toBound(),
expectPresentInSet = null,
@@ -518,7 +520,10 @@ private class DokkaDescriptorVisitor(
)
private fun KotlinType.toBound(): Bound = when (val ctor = constructor.declarationDescriptor) {
- is TypeParameterDescriptor -> OtherParameter(ctor.name.asString()).let {
+ is TypeParameterDescriptor -> OtherParameter(
+ declarationDRI = DRI.from(ctor.containingDeclaration),
+ name = ctor.name.asString()
+ ).let {
if (isMarkedNullable) Nullable(it) else it
}
else -> TypeConstructor(
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index ca8055c8..ab4a84f6 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -6,6 +6,7 @@ import com.intellij.openapi.vfs.VirtualFileManager
import com.intellij.psi.*
import com.intellij.psi.impl.source.PsiClassReferenceType
import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.links.nextTarget
import org.jetbrains.dokka.links.withClass
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.properties.PropertyContainer
@@ -159,6 +160,7 @@ object DefaultPsiToDocumentableTranslator : SourceToDocumentableTranslator {
visibility,
null,
constructors.map { parseFunction(it, true) },
+ mapTypeParameters(dri),
listOf(sourceSetData),
PropertyContainer.empty<DAnnotation>() + annotations.toList().toExtra()
)
@@ -238,9 +240,9 @@ object DefaultPsiToDocumentableTranslator : SourceToDocumentableTranslator {
dri,
if (isConstructor) "<init>" else psi.name,
isConstructor,
- psi.parameterList.parameters.mapIndexed { index, psiParameter ->
+ psi.parameterList.parameters.map { psiParameter ->
DParameter(
- dri.copy(target = index + 1),
+ dri.copy(target = dri.target.nextTarget()),
psiParameter.name,
javadocParser.parseDocumentation(psiParameter).toPlatformDependant(),
null,
@@ -321,9 +323,9 @@ object DefaultPsiToDocumentableTranslator : SourceToDocumentableTranslator {
if (bounds.isEmpty()) emptyList() else bounds.mapNotNull {
(it as? PsiClassType)?.let { classType -> Nullable(getBound(classType)) }
}
- return typeParameters.mapIndexed { index, type ->
+ return typeParameters.map { type ->
DTypeParameter(
- dri.copy(genericTarget = index),
+ dri.copy(target = dri.target.nextTarget()),
type.name.orEmpty(),
javadocParser.parseDocumentation(type).toPlatformDependant(),
null,