aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/api/base.api2
-rw-r--r--plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt4
-rw-r--r--plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt6
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/utils.kt6
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt2
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt7
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt4
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/jvmField.kt4
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/jvmName.kt6
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt4
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt4
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt5
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameProvider.kt4
13 files changed, 30 insertions, 28 deletions
diff --git a/plugins/base/api/base.api b/plugins/base/api/base.api
index 5e36f375..7875800e 100644
--- a/plugins/base/api/base.api
+++ b/plugins/base/api/base.api
@@ -1109,7 +1109,7 @@ public abstract class org/jetbrains/dokka/base/templating/SubstitutionCommand :
public final class org/jetbrains/dokka/base/templating/TypeReference {
public static final field Companion Lorg/jetbrains/dokka/base/templating/TypeReference$Companion;
- public synthetic fun <init> (Lcom/fasterxml/jackson/core/type/TypeReference;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
+ public fun <init> (Lcom/fasterxml/jackson/core/type/TypeReference;)V
}
public final class org/jetbrains/dokka/base/templating/TypeReference$Companion {
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
index 45a735c6..67e9407f 100644
--- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
+++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
@@ -102,9 +102,9 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
}
}
- private fun <T : DClasslike> classlikeSignature(c: T): List<ContentNode> {
+ private fun classlikeSignature(c: DClasslike): List<ContentNode> {
@Suppress("UNCHECKED_CAST")
- val typeAliasUnderlyingType = (c as? WithExtraProperties<out DClasslike>)
+ val typeAliasUnderlyingType = (c as? WithExtraProperties<DClasslike>)
?.extra
?.get(ActualTypealias)
?.underlyingType
diff --git a/plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt b/plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt
index 98cabd72..903063d3 100644
--- a/plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt
+++ b/plugins/base/src/main/kotlin/templating/jsonMapperForPlugins.kt
@@ -11,6 +11,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import org.jetbrains.dokka.base.DokkaBase
import java.io.File
+// TODO [beresnev] try to get rid of this copy-paste in #2933
// THIS IS COPIED FROM BASE SINCE IT NEEDS TO BE INSTANTIATED ON THE SAME CLASS LOADER AS PLUGINS
private val objectMapper = run {
@@ -26,10 +27,11 @@ private val objectMapper = run {
}
@PublishedApi
-internal class TypeReference<T> private constructor(
+internal class TypeReference<T> @PublishedApi internal constructor(
internal val jackson: com.fasterxml.jackson.core.type.TypeReference<T>
) {
companion object {
+ @PublishedApi
internal inline operator fun <reified T> invoke(): TypeReference<T> = TypeReference(jacksonTypeRef())
}
}
@@ -53,4 +55,4 @@ private object FileSerializer : StdScalarSerializer<File>(File::class.java) {
private class PluginTypeFactory: TypeFactory(null) {
override fun findClass(className: String): Class<out Any>? =
Class.forName(className, true, DokkaBase::class.java.classLoader) ?: super.findClass(className)
-} \ No newline at end of file
+}
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt
index 079cebea..379855ea 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt
@@ -5,11 +5,11 @@ import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.ExceptionInSupertypes
import org.jetbrains.dokka.model.properties.WithExtraProperties
-val <T : WithExtraProperties<out Documentable>> T.isException: Boolean
+val <T : Documentable> WithExtraProperties<T>.isException: Boolean
get() = extra[ExceptionInSupertypes] != null
-val <T> T.deprecatedAnnotation where T : WithExtraProperties<out Documentable>
+val <T : Documentable> WithExtraProperties<T>.deprecatedAnnotation
get() = extra[Annotations]?.let { annotations ->
annotations.directAnnotations.values.flatten().firstOrNull {
it.isDeprecated()
@@ -20,7 +20,7 @@ val <T> T.deprecatedAnnotation where T : WithExtraProperties<out Documentable>
* @return true if [T] has [kotlin.Deprecated] or [java.lang.Deprecated]
* annotation for **any** source set
*/
-fun <T> T.isDeprecated() where T : WithExtraProperties<out Documentable> = deprecatedAnnotation != null
+fun <T : Documentable> WithExtraProperties<T>.isDeprecated() = deprecatedAnnotation != null
/**
* @return true for [kotlin.Deprecated] and [java.lang.Deprecated]
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
index 98cf6ab6..1abd3441 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
@@ -724,7 +724,7 @@ private val divergentDocumentableComparator =
@Suppress("UNCHECKED_CAST")
private fun <T : Documentable> T.nameAfterClash(): String =
- ((this as? WithExtraProperties<out Documentable>)?.extra?.get(DriClashAwareName)?.value ?: name).orEmpty()
+ ((this as? WithExtraProperties<Documentable>)?.extra?.get(DriClashAwareName)?.value ?: name).orEmpty()
@Suppress("UNCHECKED_CAST")
internal inline fun <reified T : TagWrapper> GroupedTags.withTypeUnnamed(): SourceSetDependent<T> =
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
index 39e2525e..e6e0e037 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
@@ -119,9 +119,10 @@ object DeprecatedPageCreator : PageTransformer {
override fun invoke(input: RootPageNode): RootPageNode {
val elements = HashMap<DeprecatedPageSection, MutableSet<DeprecatedNode>>().apply {
- fun <T> T.putAs(deprecatedPageSection: DeprecatedPageSection) where
+ fun <T, V> T.putAs(deprecatedPageSection: DeprecatedPageSection) where
T : NavigableJavadocNode,
- T : WithJavadocExtra<out Documentable> {
+ V : Documentable,
+ T : WithJavadocExtra<V> {
val deprecatedNode = DeprecatedNode(
listOfNotNull(
getDRI().packageName?.takeUnless { it.isBlank() },
@@ -159,7 +160,7 @@ object DeprecatedPageCreator : PageTransformer {
it.takeIf { it.isDeprecated() }?.putAs(DeprecatedPageSection.DeprecatedEnumConstants)
}
node.takeIf { it.isDeprecated() }?.putAs(
- if ((node as? WithJavadocExtra<out Documentable>)?.isException == true) DeprecatedPageSection.DeprecatedExceptions
+ if ((node as? WithJavadocExtra<*>)?.isException == true) DeprecatedPageSection.DeprecatedExceptions
else when (node.kind) {
"enum" -> DeprecatedPageSection.DeprecatedEnums
"interface" -> DeprecatedPageSection.DeprecatedInterfaces
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 5f98494e..4df0d3c5 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt
@@ -482,7 +482,7 @@ internal fun ClassKind.asJava(): ClassKind {
}
}
-private fun PropertyContainer<out Documentable>.mergeAdditionalModifiers(second: SourceSetDependent<Set<ExtraModifiers>>) =
+private fun <T : Documentable> PropertyContainer<T>.mergeAdditionalModifiers(second: SourceSetDependent<Set<ExtraModifiers>>) =
this[AdditionalModifiers]?.squash(AdditionalModifiers(second)) ?: AdditionalModifiers(second)
private fun AdditionalModifiers.squash(second: AdditionalModifiers) =
@@ -494,4 +494,4 @@ internal fun ClassId.classNames(): String =
private fun DProperty.hasModifier(modifier: ExtraModifiers.KotlinOnlyModifiers): Boolean =
extra[AdditionalModifiers]
?.content
- ?.any { (_, modifiers) -> modifier in modifiers } == true \ No newline at end of file
+ ?.any { (_, modifiers) -> modifier in modifiers } == true
diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt
index b421bd3d..fea78abb 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/jvmField.kt
@@ -5,8 +5,8 @@ import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.jetbrains.kotlin.util.firstNotNullResult
-internal fun WithExtraProperties<out Documentable>.jvmField(): Annotations.Annotation? =
+internal fun <T : Documentable> WithExtraProperties<T>.jvmField(): Annotations.Annotation? =
extra[Annotations]?.directAnnotations?.entries?.firstNotNullResult { (_, annotations) -> annotations.jvmFieldAnnotation() }
internal fun List<Annotations.Annotation>.jvmFieldAnnotation(): Annotations.Annotation? =
- firstOrNull { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmField" } \ No newline at end of file
+ firstOrNull { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmField" }
diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt
index 44271f2c..600318e5 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/jvmName.kt
@@ -7,13 +7,13 @@ import org.jetbrains.dokka.model.isJvmName
import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.jetbrains.kotlin.util.firstNotNullResult
-internal fun WithExtraProperties<out Documentable>.directlyAnnotatedJvmName(): Annotations.Annotation? =
+internal fun <T : Documentable> WithExtraProperties<T>.directlyAnnotatedJvmName(): Annotations.Annotation? =
extra[Annotations]?.directAnnotations?.entries?.firstNotNullResult { (_, annotations)-> annotations.jvmNameAnnotation() }
-internal fun WithExtraProperties<out Documentable>.fileLevelJvmName(): Annotations.Annotation? =
+internal fun <T : Documentable> WithExtraProperties<T>.fileLevelJvmName(): Annotations.Annotation? =
extra[Annotations]?.fileLevelAnnotations?.entries?.firstNotNullResult { (_, annotations) -> annotations.jvmNameAnnotation() }
internal fun List<Annotations.Annotation>.jvmNameAnnotation(): Annotations.Annotation? =
firstOrNull { it.isJvmName() }
-internal fun Annotations.Annotation.jvmNameAsString(): String? = (params["name"] as? StringValue)?.value \ No newline at end of file
+internal fun Annotations.Annotation.jvmNameAsString(): String? = (params["name"] as? StringValue)?.value
diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt
index d8e4f67c..9913d017 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/jvmOverloads.kt
@@ -4,11 +4,11 @@ import org.jetbrains.dokka.model.Annotations
import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.properties.WithExtraProperties
-internal fun WithExtraProperties<out Documentable>.hasJvmOverloads(): Boolean {
+internal fun <T : Documentable> WithExtraProperties<T>.hasJvmOverloads(): Boolean {
return extra[Annotations]
?.directAnnotations
?.entries
?.any { (_, annotations) ->
annotations.any { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmOverloads" }
} == true
-} \ No newline at end of file
+}
diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt
index 10372ac9..50ea7795 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/jvmStatic.kt
@@ -5,8 +5,8 @@ import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.jetbrains.kotlin.util.firstNotNullResult
-internal fun WithExtraProperties<out Documentable>.jvmStatic(): Annotations.Annotation? =
+internal fun <T : Documentable> WithExtraProperties<T>.jvmStatic(): Annotations.Annotation? =
extra[Annotations]?.directAnnotations?.entries?.firstNotNullResult { (_, annotations) -> annotations.jvmStaticAnnotation() }
internal fun List<Annotations.Annotation>.jvmStaticAnnotation(): Annotations.Annotation? =
- firstOrNull { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmStatic" } \ No newline at end of file
+ firstOrNull { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmStatic" }
diff --git a/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt b/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt
index e866ec8b..9629db0c 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/jvmSynthetic.kt
@@ -1,14 +1,13 @@
package org.jetbrains.dokka.kotlinAsJava
import org.jetbrains.dokka.model.Annotations
-import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.properties.WithExtraProperties
-internal fun WithExtraProperties<out Documentable>.hasJvmSynthetic(): Boolean {
+internal fun <T : org.jetbrains.dokka.model.AnnotationTarget> WithExtraProperties<T>.hasJvmSynthetic(): Boolean {
return extra[Annotations]
?.directAnnotations
?.entries
?.any { (_, annotations) ->
annotations.any { it.dri.packageName == "kotlin.jvm" && it.dri.classNames == "JvmSynthetic" }
} == true
-} \ No newline at end of file
+}
diff --git a/plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameProvider.kt b/plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameProvider.kt
index c928ea67..4c35def7 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameProvider.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/transformers/JvmNameProvider.kt
@@ -11,12 +11,12 @@ data class Name(val fqName: String) {
}
class JvmNameProvider {
- fun <T> nameFor(entry: T): String where T : Documentable, T : WithExtraProperties<out Documentable> =
+ fun <T> nameFor(entry: T): String where T : Documentable, T : WithExtraProperties<T> =
entry.directlyAnnotatedJvmName()?.jvmNameAsString()
?: entry.name
?: throw IllegalStateException("Failed to provide a name for ${entry.javaClass.canonicalName}")
- fun <T> nameForSyntheticClass(entry: T): Name where T : WithSources, T : WithExtraProperties<out Documentable>, T : Documentable {
+ fun <T> nameForSyntheticClass(entry: T): Name where T : WithSources, T : WithExtraProperties<T>, T : Documentable {
val name: String = (entry.fileLevelJvmName()?.params?.get("name") as? StringValue)?.value
?: (entry.sources.entries.first().value.path.split("/").last().split(".").first().capitalize() + "Kt")
return Name("${entry.dri.packageName}.$name")