aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2022-06-19 17:30:05 +0200
committerGitHub <noreply@github.com>2022-06-19 17:30:05 +0200
commit89fc2494b40624c03a74e01f2f4ec4941bb5314d (patch)
treede6a8ae616f2f06e02d3c5b0a0fce20c1b08315a /plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt
parenta11a8dd92fcccff770d6893f27c3546fef17655d (diff)
downloaddokka-89fc2494b40624c03a74e01f2f4ec4941bb5314d.tar.gz
dokka-89fc2494b40624c03a74e01f2f4ec4941bb5314d.tar.bz2
dokka-89fc2494b40624c03a74e01f2f4ec4941bb5314d.zip
Fix incorrectly labeling java properties as val/var (#2540)
Fixes #2539
Diffstat (limited to 'plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt')
-rw-r--r--plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt29
1 files changed, 23 insertions, 6 deletions
diff --git a/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt b/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt
index 8dd74ef2..9c1265a6 100644
--- a/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt
+++ b/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt
@@ -1,10 +1,10 @@
package superFields
-import org.jetbrains.dokka.DokkaConfiguration
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.IsVar
import org.jetbrains.dokka.model.isJvmField
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Assertions.assertNull
@@ -58,6 +58,7 @@ class PsiSuperFieldsTest : BaseAbstractTest() {
|package test
|open class A {
| var a: Int = 1
+ | val b: Int = 2
|}
|
|/src/test/B.java
@@ -68,13 +69,25 @@ class PsiSuperFieldsTest : BaseAbstractTest() {
) {
documentablesMergingStage = { module ->
val inheritorProperties = module.packages.single().classlikes.single { it.name == "B" }.properties
- val property = inheritorProperties.single { it.name == "a" }
+ inheritorProperties.single { it.name == "a" }.let { mutableProperty ->
+ assertNotNull(mutableProperty.getter)
+ assertNotNull(mutableProperty.setter)
- assertNotNull(property.getter)
- assertNotNull(property.setter)
+ val inheritedFrom = mutableProperty.extra[InheritedMember]?.inheritedFrom?.values?.single()
+ assertEquals(DRI(packageName = "test", classNames = "A"), inheritedFrom)
- val inheritedFrom = property.extra[InheritedMember]?.inheritedFrom?.values?.single()
- assertEquals(DRI(packageName = "test", classNames = "A"), inheritedFrom)
+ assertNotNull(mutableProperty.extra[IsVar])
+ }
+
+ inheritorProperties.single { it.name == "b" }.let { immutableProperty ->
+ assertNotNull(immutableProperty.getter)
+ assertNull(immutableProperty.setter)
+
+ val inheritedFrom = immutableProperty.extra[InheritedMember]?.inheritedFrom?.values?.single()
+ assertEquals(DRI(packageName = "test", classNames = "A"), inheritedFrom)
+
+ assertNull(immutableProperty.extra[IsVar])
+ }
}
}
}
@@ -107,6 +120,8 @@ class PsiSuperFieldsTest : BaseAbstractTest() {
val inheritedFrom = property.extra[InheritedMember]?.inheritedFrom?.values?.single()
assertEquals(DRI(packageName = "test", classNames = "A"), inheritedFrom)
+
+ assertNotNull(property.extra[IsVar])
}
}
}
@@ -151,6 +166,8 @@ class PsiSuperFieldsTest : BaseAbstractTest() {
val inheritedFrom = property.extra[InheritedMember]?.inheritedFrom?.values?.single()
assertEquals(DRI(packageName = "test", classNames = "A"), inheritedFrom)
+
+ assertNotNull(property.extra[IsVar])
}
}
}