aboutsummaryrefslogtreecommitdiff
path: root/plugins/kotlin-as-java
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2023-05-17 21:07:19 +0300
committerGitHub <noreply@github.com>2023-05-17 21:07:19 +0300
commita9b3ee192ac09e2e1569a828a9da05d502fb2c75 (patch)
treedde2db404c95dd06176ce6cfebf5db131bd05538 /plugins/kotlin-as-java
parent3fc8b83aa53a83e8e2915b22ff79acd6e6bb8d28 (diff)
downloaddokka-a9b3ee192ac09e2e1569a828a9da05d502fb2c75.tar.gz
dokka-a9b3ee192ac09e2e1569a828a9da05d502fb2c75.tar.bz2
dokka-a9b3ee192ac09e2e1569a828a9da05d502fb2c75.zip
Update KGP to 1.8.20 (#2989)
* Update KGP to 1.8.20 * Update AGP to be compatible with KGP * Replace `AndroidSourceSet` * Dump API * Update integration tests * Update GH actions tests * Refactor Gradle Runner * Fix `TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION` * Suppress source sets without compilations Dokka suppresses source sets that do no have compilation since such configuration is invalid, it reports a warning or an error * Introduce `dependsOn` for a new `com.android.build.api.dsl.AndroidSourceSet` * API dump * Add comment * Suppress remaining `TYPE_MISMATCH_WARNING_FOR_INCORRECT_CAPTURE_APPROXIMATION` * Add comment --------- Co-authored-by: Ignat Beresnev <ignat.beresnev@jetbrains.com>
Diffstat (limited to 'plugins/kotlin-as-java')
-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
7 files changed, 15 insertions, 16 deletions
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")