aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt7
-rw-r--r--plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt30
-rw-r--r--plugins/base/src/test/kotlin/utils/contentUtils.kt2
3 files changed, 36 insertions, 3 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
index 2692928b..1da8e3d1 100644
--- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
+++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
@@ -275,10 +275,15 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
link(p.name, p.dri, styles = mainStyles + p.stylesIfDeprecated(sourceSet))
operator(": ")
signatureForProjection(p.type)
- defaultValueAssign(p, sourceSet)
+
+ if (p.isNotMutable()) {
+ defaultValueAssign(p, sourceSet)
+ }
}
}
+ private fun DProperty.isNotMutable(): Boolean = !isMutable()
+
private fun DProperty.isMutable(): Boolean {
return this.extra[IsVar] != null || this.setter != null
}
diff --git a/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt b/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt
index c0f1ebfb..3497317c 100644
--- a/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt
+++ b/plugins/base/src/test/kotlin/content/signatures/ContentForSignaturesTest.kt
@@ -373,7 +373,35 @@ class ContentForSignaturesTest : BaseAbstractTest() {
pagesTransformationStage = { module ->
val page = module.children.single { it.name == "test" } as PackagePageNode
page.content.assertNode {
- propertySignature(emptyMap(), "protected", "", setOf("lateinit"), "var", "property", "Int", "6")
+ propertySignature(emptyMap(), "protected", "", setOf("lateinit"), "var", "property", "Int", null)
+ }
+ }
+ }
+ }
+
+ @Test
+ fun `should not display default value for mutable property`() {
+ testInline(
+ """
+ |/src/main/kotlin/test/source.kt
+ |package test
+ |
+ |var property: Int = 6
+ """.trimIndent(), testConfiguration
+ ) {
+ pagesTransformationStage = { module ->
+ val page = module.children.single { it.name == "test" } as PackagePageNode
+ page.content.assertNode {
+ propertySignature(
+ annotations = emptyMap(),
+ visibility = "",
+ modifier = "",
+ keywords = setOf(),
+ preposition = "var",
+ name = "property",
+ type = "Int",
+ value = null
+ )
}
}
}
diff --git a/plugins/base/src/test/kotlin/utils/contentUtils.kt b/plugins/base/src/test/kotlin/utils/contentUtils.kt
index 08ddf034..9f024c5b 100644
--- a/plugins/base/src/test/kotlin/utils/contentUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/contentUtils.kt
@@ -176,7 +176,7 @@ fun ContentMatcherBuilder<*>.propertySignature(
}
}
}
- if (type != null) {
+ if (value != null) {
+(" = $value")
}
}