diff options
Diffstat (limited to 'plugins/base')
13 files changed, 224 insertions, 50 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt index f934faa5..3851b39c 100644 --- a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt +++ b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt @@ -21,7 +21,7 @@ interface JvmSignatureUtils { joinToString("") { it.name.toLowerCase() + " " } fun <T : Documentable> WithExtraProperties<T>.annotations(): SourceSetDependent<List<Annotations.Annotation>> = - extra[Annotations]?.content ?: emptyMap() + extra[Annotations]?.directAnnotations ?: emptyMap() private fun PageContentBuilder.DocumentableContentBuilder.annotations( d: Documentable, @@ -131,7 +131,7 @@ interface JvmSignatureUtils { } fun <T : Documentable> WithExtraProperties<T>.stylesIfDeprecated(sourceSetData: DokkaSourceSet): Set<TextStyle> = - if (extra[Annotations]?.content?.get(sourceSetData)?.any { + if (extra[Annotations]?.directAnnotations?.get(sourceSetData)?.any { it.dri == DRI("kotlin", "Deprecated") || it.dri == DRI("java.lang", "Deprecated") } == true) setOf(TextStyle.Strikethrough) else emptySet() diff --git a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt index ecf75a1f..961d2aca 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/utils.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/utils.kt @@ -11,7 +11,7 @@ fun <T> T.isDeprecated() where T : WithExtraProperties<out Documentable> = val <T> T.deprecatedAnnotation where T : WithExtraProperties<out Documentable> get() = extra[Annotations]?.let { annotations -> - annotations.content.values.flatten().firstOrNull { + annotations.directAnnotations.values.flatten().firstOrNull { it.dri.toString() == "kotlin/Deprecated///PointingToDeclaration/" || it.dri.toString() == "java.lang/Deprecated///PointingToDeclaration/" } diff --git a/plugins/base/src/main/kotlin/transformers/pages/annotations/SinceKotlinTransformer.kt b/plugins/base/src/main/kotlin/transformers/pages/annotations/SinceKotlinTransformer.kt index acff5ada..f437ebe3 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/annotations/SinceKotlinTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/annotations/SinceKotlinTransformer.kt @@ -69,7 +69,7 @@ class SinceKotlinTransformer(val context: DokkaContext) : DocumentableTransforme private fun Documentable.appendSinceKotlin() = sourceSets.fold(documentation) { acc, sourceSet -> - safeAs<WithExtraProperties<Documentable>>()?.extra?.get(Annotations)?.content?.get(sourceSet)?.find { + safeAs<WithExtraProperties<Documentable>>()?.extra?.get(Annotations)?.directAnnotations?.get(sourceSet)?.find { it.dri == DRI("kotlin", "SinceKotlin") }?.params?.get("version").safeAs<StringValue>()?.value?.let { version -> acc.mapValues { diff --git a/plugins/base/src/main/kotlin/translators/annotationsValue.kt b/plugins/base/src/main/kotlin/translators/annotationsValue.kt new file mode 100644 index 00000000..a840816a --- /dev/null +++ b/plugins/base/src/main/kotlin/translators/annotationsValue.kt @@ -0,0 +1,3 @@ +package org.jetbrains.dokka.base.translators + +internal fun unquotedValue(value: String): String = value.removeSurrounding("\"")
\ 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 5185dc3e..00c9a8e1 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -10,6 +10,7 @@ import org.jetbrains.dokka.analysis.from import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.parsers.MarkdownParser import org.jetbrains.dokka.base.translators.isDirectlyAnException +import org.jetbrains.dokka.base.translators.unquotedValue import org.jetbrains.dokka.links.* import org.jetbrains.dokka.links.Callable import org.jetbrains.dokka.model.* @@ -19,10 +20,8 @@ import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.plugin -import org.jetbrains.dokka.plugability.query import org.jetbrains.dokka.plugability.querySingle import org.jetbrains.dokka.transformers.sources.AsyncSourceToDocumentableTranslator -import org.jetbrains.dokka.transformers.sources.SourceToDocumentableTranslator import org.jetbrains.dokka.utilities.DokkaLogger import org.jetbrains.kotlin.builtins.functions.FunctionClassDescriptor import org.jetbrains.kotlin.builtins.isBuiltinExtensionFunctionalType @@ -33,7 +32,6 @@ import org.jetbrains.kotlin.builtins.isSuspendFunctionTypeOrSubtype import org.jetbrains.kotlin.codegen.isJvmStaticInObjectOrClassOrInterface import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.descriptors.annotations.Annotated import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor import org.jetbrains.kotlin.idea.kdoc.findKDoc @@ -51,8 +49,8 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.resolve.source.KotlinSourceElement import org.jetbrains.kotlin.resolve.source.PsiSourceElement +import org.jetbrains.kotlin.resolve.source.PsiSourceFile import org.jetbrains.kotlin.types.* -import org.jetbrains.kotlin.types.model.typeConstructor import org.jetbrains.kotlin.types.typeUtil.immediateSupertypes import org.jetbrains.kotlin.types.typeUtil.isAnyOrNullableAny import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull @@ -117,7 +115,7 @@ private class DokkaDescriptorVisitor( } } - private fun <T> T.toSourceSetDependent() = mapOf(sourceSet to this) + private fun <T> T.toSourceSetDependent() = if(this != null) mapOf(sourceSet to this) else emptyMap() suspend fun visitPackageFragmentDescriptor( descriptor: PackageFragmentDescriptor, @@ -436,13 +434,16 @@ private class DokkaDescriptorVisitor( sourceSets = setOf(sourceSet), generics = generics.await(), isExpectActual = (isExpect || isActual), - extra = PropertyContainer.withAll(listOfNotNull( - (descriptor.additionalExtras() + descriptor.getAnnotationsWithBackingField() - .toAdditionalExtras()).toSet().toSourceSetDependent().toAdditionalModifiers(), - descriptor.getAnnotationsWithBackingField().toSourceSetDependent().toAnnotations(), - descriptor.getDefaultValue()?.let { DefaultValue(it) }, - InheritedMember(inheritedFrom.toSourceSetDependent()), - )) + extra = PropertyContainer.withAll( + listOfNotNull( + (descriptor.additionalExtras() + descriptor.getAnnotationsWithBackingField() + .toAdditionalExtras()).toSet().toSourceSetDependent().toAdditionalModifiers(), + (descriptor.getAnnotationsWithBackingField() + descriptor.fileLevelAnnotations()).toSourceSetDependent() + .toAnnotations(), + descriptor.getDefaultValue()?.let { DefaultValue(it) }, + InheritedMember(inheritedFrom.toSourceSetDependent()), + ) + ) ) } } @@ -489,7 +490,7 @@ private class DokkaDescriptorVisitor( extra = PropertyContainer.withAll( InheritedMember(inheritedFrom.toSourceSetDependent()), descriptor.additionalExtras().toSourceSetDependent().toAdditionalModifiers(), - descriptor.getAnnotations().toSourceSetDependent().toAnnotations() + (descriptor.getAnnotations() + descriptor.fileLevelAnnotations()).toSourceSetDependent().toAnnotations(), ) ) } @@ -588,7 +589,7 @@ private class DokkaDescriptorVisitor( val name = run { val modifier = if (isGetter) "get" else "set" val rawName = propertyDescriptor.name.asString() - "$modifier${rawName[0].toUpperCase()}${rawName.drop(1)}" + "$modifier${rawName.capitalize()}" } val parameters = @@ -782,8 +783,7 @@ private class DokkaDescriptorVisitor( private suspend fun org.jetbrains.kotlin.descriptors.annotations.Annotations.getPresentableName(): String? = map { it.toAnnotation() }.singleOrNull { it.dri.classNames == "ParameterName" }?.params?.get("name") - .safeAs<StringValue>()?.value?.drop(1) - ?.dropLast(1) // Dropping enclosing doublequotes because we don't want to have it in our custom signature serializer + .safeAs<StringValue>()?.value?.let { unquotedValue(it) } private suspend fun KotlinType.toBound(): Bound = when (this) { @@ -928,19 +928,25 @@ private class DokkaDescriptorVisitor( ) } } - else -> StringValue(toString()) + else -> StringValue(unquotedValue(toString())) } - private suspend fun AnnotationDescriptor.toAnnotation(): Annotations.Annotation { + private suspend fun AnnotationDescriptor.toAnnotation(scope: Annotations.AnnotationScope = Annotations.AnnotationScope.DIRECT): Annotations.Annotation { + val dri = DRI.from(annotationClass as DeclarationDescriptor) return Annotations.Annotation( DRI.from(annotationClass as DeclarationDescriptor), allValueArguments.map { it.key.asString() to it.value.toValue() }.filter { it.second != null }.toMap() as Map<String, AnnotationParameterValue>, - annotationClass!!.annotations.hasAnnotation(FqName("kotlin.annotation.MustBeDocumented")) + mustBeDocumented(dri), + scope ) } + private fun AnnotationDescriptor.mustBeDocumented(dri: DRI): Boolean = + if (dri.isJvmName()) false + else annotationClass!!.annotations.hasAnnotation(FqName("kotlin.annotation.MustBeDocumented")) + private suspend fun PropertyDescriptor.getAnnotationsWithBackingField(): List<Annotations.Annotation> = getAnnotations() + (backingField?.getAnnotations() ?: emptyList()) @@ -1004,6 +1010,14 @@ private class DokkaDescriptorVisitor( private fun ConstantsEnumValue.fullEnumEntryName() = "${this.enumClassId.relativeClassName.asString()}.${this.enumEntryName.identifier}" + + private fun DeclarationDescriptorWithSource.ktFile(): KtFile? = (source.containingFile as? PsiSourceFile)?.psiFile as? KtFile + + private suspend fun DeclarationDescriptorWithSource.fileLevelAnnotations() = ktFile() + ?.let { file -> resolutionFacade.resolveSession.getFileAnnotations(file) } + ?.toList() + .orEmpty() + .parallelMap { it.toAnnotation(scope = Annotations.AnnotationScope.FILE) } } private data class AncestryLevel( diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt index 9a1b05d5..cd51e9dd 100644 --- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt @@ -17,6 +17,7 @@ import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.translators.isDirectlyAnException import org.jetbrains.dokka.base.translators.psi.parsers.JavaDocumentationParser import org.jetbrains.dokka.base.translators.psi.parsers.JavadocParser +import org.jetbrains.dokka.base.translators.unquotedValue import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.links.nextTarget import org.jetbrains.dokka.links.withClass @@ -530,6 +531,9 @@ class DefaultPsiToDocumentableTranslator( private fun JvmAnnotationAttribute.toValue(): AnnotationParameterValue = when (this) { is PsiNameValuePair -> value?.toValue() ?: StringValue("") else -> StringValue(this.attributeName) + }.let { annotationValue -> + if (annotationValue is StringValue) annotationValue.copy(unquotedValue(annotationValue.value)) + else annotationValue } private fun PsiAnnotationMemberValue.toValue(): AnnotationParameterValue? = when (this) { diff --git a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt index b90c7350..d88d9505 100644 --- a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt +++ b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt @@ -4,10 +4,16 @@ import matchers.content.* import org.jetbrains.dokka.pages.ContentPage import org.jetbrains.dokka.pages.PackagePageNode import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.Annotations +import org.jetbrains.dokka.model.StringValue +import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult import org.junit.jupiter.api.Test import utils.ParamAttributes import utils.bareSignature import utils.propertySignature +import kotlin.test.assertEquals +import kotlin.test.assertFalse class ContentForAnnotationsTest : BaseAbstractTest() { @@ -18,6 +24,7 @@ class ContentForAnnotationsTest : BaseAbstractTest() { sourceSet { sourceRoots = listOf("src/") analysisPlatform = "jvm" + classpath += jvmStdlibPath!! } } } @@ -218,4 +225,43 @@ class ContentForAnnotationsTest : BaseAbstractTest() { } } } + + @Test + fun `JvmName for property with setter and getter`(){ + testInline( + """ + |/src/main/kotlin/test/source.kt + |package test + |@get:JvmName("xd") + |@set:JvmName("asd") + |var property: String + | get() = "" + | set(value) {} + """.trimIndent(), testConfiguration) { + documentablesCreationStage = { modules -> + fun expectedAnnotation(name: String) = Annotations.Annotation( + dri = DRI("kotlin.jvm", "JvmName"), + params = mapOf("name" to StringValue(name)), + scope = Annotations.AnnotationScope.DIRECT, + mustBeDocumented = false + ) + + val property = modules.flatMap { it.packages }.flatMap { it.properties }.first() + val getterAnnotation = property.getter?.extra?.get(Annotations)?.let { + it.directAnnotations.entries.firstNotNullResult { (_, annotations) -> annotations.firstOrNull() } + } + val setterAnnotation = property.getter?.extra?.get(Annotations)?.let { + it.directAnnotations.entries.firstNotNullResult { (_, annotations) -> annotations.firstOrNull() } + } + + assertEquals(expectedAnnotation("xd"), getterAnnotation) + assertFalse(getterAnnotation?.mustBeDocumented!!) + assertEquals(Annotations.AnnotationScope.DIRECT, getterAnnotation.scope) + + assertEquals(expectedAnnotation("asd"), setterAnnotation) + assertFalse(setterAnnotation?.mustBeDocumented!!) + assertEquals(Annotations.AnnotationScope.DIRECT, setterAnnotation.scope) + } + } + } } diff --git a/plugins/base/src/test/kotlin/content/annotations/FileLevelJvmNameTest.kt b/plugins/base/src/test/kotlin/content/annotations/FileLevelJvmNameTest.kt new file mode 100644 index 00000000..f2fd518c --- /dev/null +++ b/plugins/base/src/test/kotlin/content/annotations/FileLevelJvmNameTest.kt @@ -0,0 +1,111 @@ +package content.annotations + +import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.Annotations +import org.jetbrains.dokka.model.StringValue +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ValueSource +import kotlin.test.assertEquals + +class FileLevelJvmNameTest : BaseAbstractTest() { + private val testConfiguration = dokkaConfiguration { + sourceSets { + sourceSet { + sourceRoots = listOf("src/") + analysisPlatform = "jvm" + classpath += jvmStdlibPath!! + } + } + } + + companion object { + private const val functionTest = + """ + |/src/main/kotlin/test/source.kt + |@file:JvmName("CustomJvmName") + |package test + | + |fun function(abc: String): String { + | return "Hello, " + abc + |} + """ + + private const val extensionFunctionTest = + """ + |/src/main/kotlin/test/source.kt + |@file:JvmName("CustomJvmName") + |package test + | + |fun String.function(abc: String): String { + | return "Hello, " + abc + |} + """ + + private const val propertyTest = + """ + |/src/main/kotlin/test/source.kt + |@file:JvmName("CustomJvmName") + |package test + | + |val property: String + | get() = "" + """ + + private const val extensionPropertyTest = + """ + |/src/main/kotlin/test/source.kt + |@file:JvmName("CustomJvmName") + |package test + | + |val String.property: String + | get() = "" + """ + } + + @ParameterizedTest + @ValueSource(strings = [functionTest, extensionFunctionTest]) + fun `jvm name should be included in functions extra`(query: String) { + testInline( + query.trimIndent(), testConfiguration + ) { + documentablesCreationStage = { modules -> + val expectedAnnotation = Annotations.Annotation( + dri = DRI("kotlin.jvm", "JvmName"), + params = mapOf("name" to StringValue("CustomJvmName")), + scope = Annotations.AnnotationScope.FILE, + mustBeDocumented = false + ) + val function = modules.flatMap { it.packages }.first().functions.first() + val annotation = function.extra[Annotations]?.fileLevelAnnotations?.entries?.first()?.value?.single() + assertEquals(emptyMap(), function.extra[Annotations]?.directAnnotations) + assertEquals(expectedAnnotation, annotation) + assertEquals(expectedAnnotation.scope, annotation?.scope) + assertEquals(expectedAnnotation.mustBeDocumented, annotation?.mustBeDocumented) + } + } + } + + @ParameterizedTest + @ValueSource(strings = [propertyTest, extensionPropertyTest]) + fun `jvm name should be included in properties extra`(query: String) { + testInline( + query.trimIndent(), testConfiguration + ) { + documentablesCreationStage = { modules -> + val expectedAnnotation = Annotations.Annotation( + dri = DRI("kotlin.jvm", "JvmName"), + params = mapOf("name" to StringValue("CustomJvmName")), + scope = Annotations.AnnotationScope.FILE, + mustBeDocumented = false + ) + val properties = modules.flatMap { it.packages }.first().properties.first() + val annotation = properties.extra[Annotations]?.fileLevelAnnotations?.entries?.first()?.value?.single() + assertEquals(emptyMap(), properties.extra[Annotations]?.directAnnotations) + assertEquals(expectedAnnotation, annotation) + assertEquals(expectedAnnotation.scope, annotation?.scope) + assertEquals(expectedAnnotation.mustBeDocumented, annotation?.mustBeDocumented) + } + } + } +}
\ No newline at end of file diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt index b6787126..2260a46f 100644 --- a/plugins/base/src/test/kotlin/model/ClassesTest.kt +++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt @@ -182,12 +182,12 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class """ ) { with((this / "classes" / "Foo").cast<DClass>()) { - with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) { + with(extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) { this counts 1 with(first()) { dri.classNames equals "Deprecated" params.entries counts 1 - (params["message"].assertNotNull("message") as StringValue).value equals "\"should no longer be used\"" + (params["message"].assertNotNull("message") as StringValue).value equals "should no longer be used" } } } @@ -361,12 +361,12 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class """ ) { with((this / "classes" / "C").cast<DClass>()) { - with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) { + with(extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) { this counts 1 with(first()) { dri.classNames equals "SinceKotlin" params.entries counts 1 - (params["version"].assertNotNull("version") as StringValue).value equals "\"1.1\"" + (params["version"].assertNotNull("version") as StringValue).value equals "1.1" } } } @@ -426,9 +426,9 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class """@Suppress("abc") class Foo() {}""" ) { with((this / "classes" / "Foo").cast<DClass>()) { - with(extra[Annotations]?.content?.values?.firstOrNull()?.firstOrNull().assertNotNull("annotations")) { + with(extra[Annotations]?.directAnnotations?.values?.firstOrNull()?.firstOrNull().assertNotNull("annotations")) { dri.toString() equals "kotlin/Suppress///PointingToDeclaration/" - (params["names"].assertNotNull("param") as ArrayValue).value equals listOf(StringValue("\"abc\"")) + (params["names"].assertNotNull("param") as ArrayValue).value equals listOf(StringValue("abc")) } } } @@ -446,7 +446,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class """ ) { with((this / "classes" / "throws").cast<DAnnotation>()) { - with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) { + with(extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) { this counts 1 with(first()) { dri.classNames equals "Retention" diff --git a/plugins/base/src/test/kotlin/model/FunctionsTest.kt b/plugins/base/src/test/kotlin/model/FunctionsTest.kt index 9fffb4fc..ac9b6d7d 100644 --- a/plugins/base/src/test/kotlin/model/FunctionsTest.kt +++ b/plugins/base/src/test/kotlin/model/FunctionsTest.kt @@ -141,12 +141,12 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun """ ) { with((this / "function" / "f").cast<DFunction>()) { - with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) { + with(extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) { this counts 1 with(first()) { dri.classNames equals "Suppress" params.entries counts 1 - (params["names"].assertNotNull("param") as ArrayValue).value equals listOf(StringValue("\"FOO\"")) + (params["names"].assertNotNull("param") as ArrayValue).value equals listOf(StringValue("FOO")) } } } @@ -226,7 +226,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun """ ) { with((this / "function" / "Fancy").cast<DAnnotation>()) { - with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) { + with(extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) { this counts 3 with(map { it.dri.classNames to it }.toMap()) { with(this["Target"].assertNotNull("Target")) { @@ -249,7 +249,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun } with((this / "function" / "function" / "notInlined").cast<DParameter>()) { - with(this.extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) { + with(this.extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) { this counts 1 with(first()) { dri.classNames equals "Fancy" @@ -296,7 +296,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun } } - with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) { + with(extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) { this counts 3 with(map { it.dri.classNames to it }.toMap()) { with(this["Target"].assertNotNull("Target")) { @@ -319,7 +319,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun } with((this / "function" / "f").cast<DFunction>()) { - with(this.extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) { + with(this.extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) { this counts 1 with(this.first()) { dri.classNames equals "Fancy" @@ -381,12 +381,12 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun """ ) { with((this / "function" / "f").cast<DFunction>()) { - with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) { + with(extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) { this counts 1 with(first()) { dri.classNames equals "SinceKotlin" params.entries counts 1 - (params["version"].assertNotNull("version") as StringValue).value equals "\"1.1\"" + (params["version"].assertNotNull("version") as StringValue).value equals "1.1" } } } diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt index 18927218..beb7c8e4 100644 --- a/plugins/base/src/test/kotlin/model/JavaTest.kt +++ b/plugins/base/src/test/kotlin/model/JavaTest.kt @@ -274,7 +274,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") { """ ) { with((this / "java" / "Attribute").cast<DAnnotation>()) { - with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) { + with(extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) { with(single()) { dri.classNames equals "Target" (params["value"].assertNotNull("value") as ArrayValue).value equals listOf( diff --git a/plugins/base/src/test/kotlin/model/PropertyTest.kt b/plugins/base/src/test/kotlin/model/PropertyTest.kt index af952b43..8474116f 100644 --- a/plugins/base/src/test/kotlin/model/PropertyTest.kt +++ b/plugins/base/src/test/kotlin/model/PropertyTest.kt @@ -150,12 +150,12 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro """ ) { with((this / "property" / "prop").cast<DProperty>()) { - with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) { + with(extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) { this counts 1 with(first()) { dri.classNames equals "SinceKotlin" params.entries counts 1 - (params["version"].assertNotNull("version") as StringValue).value equals "\"1.1\"" + (params["version"].assertNotNull("version") as StringValue).value equals "1.1" } } } @@ -178,7 +178,7 @@ class PropertyTest : AbstractModelTest("/src/main/kotlin/property/Test.kt", "pro } ) { with((this / "property" / "property").cast<DProperty>()) { - with(extra[Annotations]!!.content.entries.single().value.assertNotNull("Annotations")) { + with(extra[Annotations]!!.directAnnotations.entries.single().value.assertNotNull("Annotations")) { this counts 1 with(first()) { dri.classNames equals "Strictfp" diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt index ba4b631f..f9d95f46 100644 --- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt @@ -1,11 +1,7 @@ package signatures -import org.jetbrains.dokka.DokkaConfiguration import org.jetbrains.dokka.DokkaSourceSetID -import org.jetbrains.dokka.jdk import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest -import org.jsoup.Jsoup -import org.jsoup.nodes.Element import org.junit.jupiter.api.Test import utils.* @@ -295,7 +291,7 @@ class SignatureTest : BaseAbstractTest() { .firstSignature() .match( Div( - Div("@", A("Marking"), "(", Span("msg = ", Span("\"Nenya\"")), Wbr, ")"), + Div("@", A("Marking"), "(", Span("msg = ", Span("Nenya")), Wbr, ")"), Div("@", A("Marking2"), "(", Span("int = ", Span("1")), Wbr, ")") ), "fun ", A("simpleFun"), @@ -332,9 +328,9 @@ class SignatureTest : BaseAbstractTest() { Div( "@", A("Marking"), "(", Span( "msg = [", - Span(Span("\"Nenya\""), ", "), Wbr, - Span(Span("\"Vilya\""), ", "), Wbr, - Span(Span("\"Narya\"")), Wbr, "]" + Span(Span("Nenya"), ", "), Wbr, + Span(Span("Vilya"), ", "), Wbr, + Span(Span("Narya")), Wbr, "]" ), Wbr, ")" ) ), |