Skip to content

Commit

Permalink
Apply requested changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
BarkingBad committed Mar 14, 2022
1 parent bb746c9 commit fed49b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<DocumentationNode>.translatePropertyToDescription(): SourceSetDependent<DocumentationNode> {
fun SourceSetDependent<DocumentationNode>.translatePropertyTagToDescription(): SourceSetDependent<DocumentationNode> {
return this.mapValues { (_, value) ->
value.copy(children = value.children.map {
when (it) {
Expand All @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -93,7 +94,6 @@ class PsiSuperFieldsTest : BaseAbstractTest() {
}
}

@Disabled // TODO: Remove with Kotlin 1.6.20
@Test
fun `java inheriting kotlin with @JvmField should not inherit beans`() {
testInline(
Expand Down Expand Up @@ -126,8 +126,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(
Expand Down

0 comments on commit fed49b3

Please sign in to comment.