aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/transformers
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-06-22 12:15:50 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-06-22 12:55:58 +0200
commitf6530934d36fbb977c2b7c4eb3669a8f581dd9f5 (patch)
tree9e9501347db191fdfebb235d400e20169076222c /plugins/base/src/main/kotlin/transformers
parent442a4651880ec2018728f64028c627776d000e9a (diff)
downloaddokka-f6530934d36fbb977c2b7c4eb3669a8f581dd9f5.tar.gz
dokka-f6530934d36fbb977c2b7c4eb3669a8f581dd9f5.tar.bz2
dokka-f6530934d36fbb977c2b7c4eb3669a8f581dd9f5.zip
Prevent ReportUndocumentedTransformer.kt from reporting "componentN" functions fromd data classes
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers')
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt26
1 files changed, 19 insertions, 7 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
index bb26ceef..7d475571 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/ReportUndocumentedTransformer.kt
@@ -7,6 +7,7 @@ import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.transformers.documentation.DocumentableTransformer
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.FAKE_OVERRIDE
+import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.SYNTHESIZED
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
internal class ReportUndocumentedTransformer : DocumentableTransformer {
@@ -45,6 +46,10 @@ internal class ReportUndocumentedTransformer : DocumentableTransformer {
return false
}
+ if (isSynthesized(documentable, sourceSet)) {
+ return false
+ }
+
if (isPrivateOrInternalApi(documentable, sourceSet)) {
return false
}
@@ -124,16 +129,23 @@ internal class ReportUndocumentedTransformer : DocumentableTransformer {
}
private fun isFakeOverride(documentable: Documentable, sourceSet: SourceSetData): Boolean {
+ return callableMemberDescriptorOrNull(documentable, sourceSet)?.kind == FAKE_OVERRIDE
+ }
+
+ private fun isSynthesized(documentable: Documentable, sourceSet: SourceSetData): Boolean {
+ return callableMemberDescriptorOrNull(documentable, sourceSet)?.kind == SYNTHESIZED
+ }
+
+ private fun callableMemberDescriptorOrNull(
+ documentable: Documentable, sourceSet: SourceSetData
+ ): CallableMemberDescriptor? {
if (documentable is WithExpectActual) {
- val callableMemberDescriptor = documentable.sources[sourceSet]
+ return documentable.sources[sourceSet]
.safeAs<DescriptorDocumentableSource>()?.descriptor
- .safeAs<CallableMemberDescriptor>()
-
- if (callableMemberDescriptor?.kind == FAKE_OVERRIDE) {
- return true
- }
+ .safeAs()
}
- return false
+
+ return null
}
private fun isPrivateOrInternalApi(documentable: Documentable, sourceSet: SourceSetData): Boolean {