diff options
Diffstat (limited to 'plugins/kotlin-as-java/src/main')
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") |