aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/utils
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-07-05 10:04:55 +0200
committerGitHub <noreply@github.com>2023-07-05 10:04:55 +0200
commit9559158bfeeb274e9ccf1b4563f1b23b42afc493 (patch)
tree3ece0887623cfe2b7148af23001867a1dd5e6597 /plugins/base/src/main/kotlin/utils
parentcbd9733d3dd2f52992e98e7cebd072091a572529 (diff)
downloaddokka-9559158bfeeb274e9ccf1b4563f1b23b42afc493.tar.gz
dokka-9559158bfeeb274e9ccf1b4563f1b23b42afc493.tar.bz2
dokka-9559158bfeeb274e9ccf1b4563f1b23b42afc493.zip
Decompose Kotlin/Java analysis (#3034)
* Extract analysis into separate modules
Diffstat (limited to 'plugins/base/src/main/kotlin/utils')
-rw-r--r--plugins/base/src/main/kotlin/utils/CollectionExtensions.kt12
-rw-r--r--plugins/base/src/main/kotlin/utils/NoopIntellijLogger.kt43
2 files changed, 12 insertions, 43 deletions
diff --git a/plugins/base/src/main/kotlin/utils/CollectionExtensions.kt b/plugins/base/src/main/kotlin/utils/CollectionExtensions.kt
new file mode 100644
index 00000000..6fc5271f
--- /dev/null
+++ b/plugins/base/src/main/kotlin/utils/CollectionExtensions.kt
@@ -0,0 +1,12 @@
+package org.jetbrains.dokka.base.utils
+
+// 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
+}
diff --git a/plugins/base/src/main/kotlin/utils/NoopIntellijLogger.kt b/plugins/base/src/main/kotlin/utils/NoopIntellijLogger.kt
deleted file mode 100644
index 9248f996..00000000
--- a/plugins/base/src/main/kotlin/utils/NoopIntellijLogger.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.jetbrains.dokka.base.utils
-
-import com.intellij.openapi.diagnostic.Attachment
-import com.intellij.openapi.diagnostic.DefaultLogger
-import com.intellij.openapi.diagnostic.Logger
-
-internal class NoopIntellijLoggerFactory : Logger.Factory {
- override fun getLoggerInstance(p0: String): Logger = NoopIntellijLogger
-}
-
-/**
- * Ignores all messages passed to it
- */
-internal object NoopIntellijLogger : DefaultLogger(null) {
- override fun isDebugEnabled(): Boolean = false
- override fun isTraceEnabled(): Boolean = false
-
- override fun debug(message: String?) {}
- override fun debug(t: Throwable?) {}
- override fun debug(message: String?, t: Throwable?) {}
- override fun debug(message: String, vararg details: Any?) {}
- override fun debugValues(header: String, values: MutableCollection<*>) {}
-
- override fun trace(message: String?) {}
- override fun trace(t: Throwable?) {}
-
- override fun info(message: String?) {}
- override fun info(message: String?, t: Throwable?) {}
- override fun info(t: Throwable) {}
-
- override fun warn(message: String?, t: Throwable?) {}
- override fun warn(message: String?) {}
- override fun warn(t: Throwable) {}
-
- override fun error(message: String?, t: Throwable?, vararg details: String?) {}
- override fun error(message: String?) {}
- override fun error(message: Any?) {}
- override fun error(message: String?, vararg attachments: Attachment?) {}
- override fun error(message: String?, t: Throwable?, vararg attachments: Attachment?) {}
- override fun error(message: String?, vararg details: String?) {}
- override fun error(message: String?, t: Throwable?) {}
- override fun error(t: Throwable) {}
-}