aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/translators/CollectionExtensions.kt
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2022-05-31 15:34:37 +0200
committerGitHub <noreply@github.com>2022-05-31 15:34:37 +0200
commit623cf222ca2ac5e8b9628af5927956ecb6d44d1e (patch)
treea995477a569dd27b99d24bd901bdcc024f4f7dd0 /plugins/base/src/main/kotlin/translators/CollectionExtensions.kt
parent8913c97b25ebf5061ea367129544d7e5186a738d (diff)
downloaddokka-623cf222ca2ac5e8b9628af5927956ecb6d44d1e.tar.gz
dokka-623cf222ca2ac5e8b9628af5927956ecb6d44d1e.tar.bz2
dokka-623cf222ca2ac5e8b9628af5927956ecb6d44d1e.zip
Fix gathering inherited properties (#2481)
* Fix gathering inherited properties in PSI * Refacotr KaJ transformer. Change wrapping TagWrapper for getters and setters. * Add logic to merge inherited properties in kotlin from java sources. * Remove getters and setters from JvmField properties for DObject, DEnum, DInterface in KaJ. * Unify InheritedMember DRI logic. * Fix gathering docs obtained from inheriting java sources in descriptors * Apply requested changes. * Resolve rebase conflicts * Use 221 for qodana analysis * Move accessors generation into DefaultDescriptorToDocumentableTranslator * Fix special "is" case for accessors and refactor logic in general * Remove ambiguous import after rebasing * Remove unused imports and format code * Apply review comment suggestions * Preserve previously lost accessor lookalikes * Extract a variable and correct a typo Co-authored-by: Andrzej Ratajczak <andrzej.ratajczak98@gmail.com>
Diffstat (limited to 'plugins/base/src/main/kotlin/translators/CollectionExtensions.kt')
-rw-r--r--plugins/base/src/main/kotlin/translators/CollectionExtensions.kt12
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/base/src/main/kotlin/translators/CollectionExtensions.kt b/plugins/base/src/main/kotlin/translators/CollectionExtensions.kt
new file mode 100644
index 00000000..0de4b5b1
--- /dev/null
+++ b/plugins/base/src/main/kotlin/translators/CollectionExtensions.kt
@@ -0,0 +1,12 @@
+package org.jetbrains.dokka.base.translators
+
+// TODO [beresnev] remove this copy-paste and use the same method from stdlib instead after updating to 1.5
+internal inline fun <T, R : Any> Iterable<T>.firstNotNullOfOrNull(transform: (T) -> R?): R? {
+ for (element in this) {
+ val result = transform(element)
+ if (result != null) {
+ return result
+ }
+ }
+ return null
+}