aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2020-11-12 12:01:00 +0100
committerGitHub <noreply@github.com>2020-11-12 12:01:00 +0100
commit6a1c05c2d340a6812a8b58d3027d8e5712db45a2 (patch)
treeb14c5b0a26fbb61bb5492b1a778e5df57fcd584d /core/src/main/kotlin
parent7db15c357a417ccd9ff8ad1f90f5aff84eec132f (diff)
downloaddokka-6a1c05c2d340a6812a8b58d3027d8e5712db45a2.tar.gz
dokka-6a1c05c2d340a6812a8b58d3027d8e5712db45a2.tar.bz2
dokka-6a1c05c2d340a6812a8b58d3027d8e5712db45a2.zip
Javadoc @inheritDoc tag support (#1608)
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r--core/src/main/kotlin/model/doc/TagWrapper.kt1
-rw-r--r--core/src/main/kotlin/utilities/nodeDebug.kt50
-rw-r--r--core/src/main/kotlin/utilities/safeEnumValueOf.kt4
3 files changed, 5 insertions, 50 deletions
diff --git a/core/src/main/kotlin/model/doc/TagWrapper.kt b/core/src/main/kotlin/model/doc/TagWrapper.kt
index cea132a8..f4737093 100644
--- a/core/src/main/kotlin/model/doc/TagWrapper.kt
+++ b/core/src/main/kotlin/model/doc/TagWrapper.kt
@@ -22,6 +22,7 @@ data class Param(override val root: DocTag, override val name: String) : NamedTa
data class Return(override val root: DocTag) : TagWrapper()
data class Receiver(override val root: DocTag) : TagWrapper()
data class Constructor(override val root: DocTag) : TagWrapper()
+//TODO this naming is confusing since kotlin has Throws annotation
data class Throws(override val root: DocTag, override val name: String, val exceptionAddress: DRI?) : NamedTagWrapper()
data class Sample(override val root: DocTag, override val name: String) : NamedTagWrapper()
data class Deprecated(override val root: DocTag) : TagWrapper()
diff --git a/core/src/main/kotlin/utilities/nodeDebug.kt b/core/src/main/kotlin/utilities/nodeDebug.kt
deleted file mode 100644
index 0e8c61f7..00000000
--- a/core/src/main/kotlin/utilities/nodeDebug.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.jetbrains.dokka.utilities
-
-import org.jetbrains.dokka.model.Documentable
-import org.jetbrains.dokka.pages.*
-
-const val DOWN = '\u2503'
-const val BRANCH = '\u2523'
-const val LAST = '\u2517'
-
-fun Documentable.pretty(prefix: String = "", isLast: Boolean = true): String {
- val nextPrefix = prefix + (if (isLast) ' ' else DOWN) + ' '
-
- return prefix + (if (isLast) LAST else BRANCH) + this.toString() +
- children.dropLast(1)
- .map { it.pretty(nextPrefix, false) }
- .plus(children.lastOrNull()?.pretty(nextPrefix))
- .filterNotNull()
- .takeIf { it.isNotEmpty() }
- ?.joinToString(prefix = "\n", separator = "")
- .orEmpty() + if (children.isEmpty()) "\n" else ""
-}
-
-//fun Any.genericPretty(prefix: String = "", isLast: Boolean = true): String {
-// val nextPrefix = prefix + (if (isLast) ' ' else DOWN) + ' '
-//
-// return prefix + (if (isLast) LAST else BRANCH) + this.stringify() +
-// allChildren().dropLast(1)
-// .map { it.genericPretty(nextPrefix, false) }
-// .plus(allChildren().lastOrNull()?.genericPretty(nextPrefix))
-// .filterNotNull()
-// .takeIf { it.isNotEmpty() }
-// ?.joinToString(prefix = "\n", separator = "")
-// .orEmpty() + if (allChildren().isEmpty()) "\n" else ""
-//}
-private fun Any.stringify() = when(this) {
- is ContentNode -> toString() + this.dci
- is ContentPage -> this.name + this::class.simpleName
- else -> toString()
-}
-//private fun Any.allChildren() = when(this){
-// is PageNode -> children + content
-// is ContentBlock -> this.children
-// is ContentHeader -> this.items
-// is ContentStyle -> this.items
-// is ContentSymbol -> this.parts
-// is ContentComment -> this.parts
-// is ContentGroup -> this.children
-// is ContentList -> this.items
-// else -> emptyList()
-//}
diff --git a/core/src/main/kotlin/utilities/safeEnumValueOf.kt b/core/src/main/kotlin/utilities/safeEnumValueOf.kt
new file mode 100644
index 00000000..8fd5a086
--- /dev/null
+++ b/core/src/main/kotlin/utilities/safeEnumValueOf.kt
@@ -0,0 +1,4 @@
+package org.jetbrains.dokka.utilities
+
+inline fun <reified T : Enum<*>> enumValueOrNull(name: String): T? =
+ T::class.java.enumConstants.firstOrNull { it.name.toUpperCase() == name.toUpperCase() } \ No newline at end of file