diff --git a/core/src/main/kotlin/model/JvmField.kt b/core/src/main/kotlin/model/JvmField.kt index a2f140cd8c4..623115e0bdc 100644 --- a/core/src/main/kotlin/model/JvmField.kt +++ b/core/src/main/kotlin/model/JvmField.kt @@ -7,4 +7,4 @@ const val JVM_FIELD_CLASS_NAMES = "JvmField" fun DRI.isJvmField(): Boolean = packageName == JVM_FIELD_PACKAGE_NAME && classNames == JVM_FIELD_CLASS_NAMES -fun Annotations.Annotation.isJvmField(): Boolean = dri.isJvmName() +fun Annotations.Annotation.isJvmField(): Boolean = dri.isJvmField() diff --git a/plugins/base/src/main/kotlin/transformers/documentables/PropertiesMergerTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/PropertiesMergerTransformer.kt index b4732932e25..77c88285ef5 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/PropertiesMergerTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/PropertiesMergerTransformer.kt @@ -63,7 +63,7 @@ class PropertiesMergerTransformer : PreMergeDocumentableTransformer { } /** - * This is losely copied from here + * This is loosely copied from here * [org.jetbrains.dokka.base.translators.psi.DefaultPsiToDocumentableTranslator.DokkaPsiParser.splitFunctionsAndAccessors] * we should consider if we could unify that. * TODO: Revisit that diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index 930c6cc70c6..59811bf8df9 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -439,7 +439,7 @@ private class DokkaDescriptorVisitor( * declared and inheritedFrom as the same DRI but truncated callable part. * Therefore, we set callable to null and take the DRI only if it is indeed coming from different class. */ - val inheritedFrom = dri.copy(callable = null).takeIf { parent.dri.classNames != dri.classNames } + val inheritedFrom = dri.copy(callable = null).takeIf { parent.dri.classNames != dri.classNames || parent.dri.packageName != dri.packageName } val descriptor = originalDescriptor.getConcreteDescriptor() val isExpect = descriptor.isExpect val isActual = descriptor.isActual @@ -499,7 +499,7 @@ private class DokkaDescriptorVisitor( * To avoid redundant docs, please visit [visitPropertyDescriptor] inheritedFrom * local val documentation. */ - val inheritedFrom = dri.copy(callable = null).takeIf { parent.dri.classNames != dri.classNames } + val inheritedFrom = dri.copy(callable = null).takeIf { parent.dri.classNames != dri.classNames || parent.dri.packageName != dri.packageName } val descriptor = originalDescriptor.getConcreteDescriptor() val isExpect = descriptor.isExpect val isActual = descriptor.isActual @@ -666,13 +666,13 @@ private class DokkaDescriptorVisitor( * Workaround for problem with inheriting TagWrappers. * There is an issue if one declare documentation in the class header for * property using this syntax: `@property` - * The compiler will propagate it withing this tag to property and to its getters and setters. + * The compiler will propagate the text wrapped in this tag to property and to its getters and setters. * * Actually, the problem impacts more of these tags, yet this particular tag was blocker for * some opens-source plugin creators. * TODO: Should rethink if we could fix it globally in dokka or in compiler itself. */ - fun SourceSetDependent.translatePropertyToDescription(): SourceSetDependent { + fun SourceSetDependent.translatePropertyTagToDescription(): SourceSetDependent { return this.mapValues { (_, value) -> value.copy(children = value.children.map { when (it) { @@ -689,7 +689,7 @@ private class DokkaDescriptorVisitor( isConstructor = false, parameters = parameters, visibility = descriptor.visibility.toDokkaVisibility().toSourceSetDependent(), - documentation = descriptor.resolveDescriptorData().translatePropertyToDescription(), + documentation = descriptor.resolveDescriptorData().translatePropertyTagToDescription(), type = descriptor.returnType!!.toBound(), generics = generics.await(), modifier = descriptor.modifier().toSourceSetDependent(), diff --git a/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt b/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt index 7d45f91099a..257bd94683a 100644 --- a/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt +++ b/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt @@ -4,6 +4,7 @@ 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.InheritedMember +import org.jetbrains.dokka.model.isJvmField import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Assertions.assertNotNull import org.junit.jupiter.api.Assertions.assertNull @@ -126,8 +127,7 @@ class PsiSuperFieldsTest : BaseAbstractTest() { assertNull(this.getter) assertNull(this.setter) assertNotNull(this.extra[Annotations]?.directAnnotations?.values?.single()?.find { - it.dri.packageName == "kotlin.jvm" && - it.dri.classNames == "JvmField" + it.isJvmField() }) this.extra[InheritedMember]?.inheritedFrom?.values?.single()?.run { assertEquals(