aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/CoreExtensions.kt5
-rw-r--r--core/src/main/kotlin/plugability/DefaultExtensions.kt13
-rw-r--r--core/src/main/kotlin/plugability/DokkaContext.kt17
-rw-r--r--plugins/base/src/main/kotlin/renderers/FileWriter.kt1
4 files changed, 4 insertions, 32 deletions
diff --git a/core/src/main/kotlin/CoreExtensions.kt b/core/src/main/kotlin/CoreExtensions.kt
index c8314f4d..82a1c367 100644
--- a/core/src/main/kotlin/CoreExtensions.kt
+++ b/core/src/main/kotlin/CoreExtensions.kt
@@ -10,11 +10,6 @@ import org.jetbrains.dokka.transformers.pages.PageNodeTransformer
import org.jetbrains.dokka.transformers.psi.PsiToDocumentationTranslator
import kotlin.reflect.KProperty
-
-/**
- * Extension points declared by dokka core.
- * Default values are stored in [org.jetbrains.dokka.plugability.DefaultExtensions]
- */
object CoreExtensions {
val descriptorToDocumentationTranslator by coreExtension<DescriptorToDocumentationTranslator>()
val psiToDocumentationTranslator by coreExtension<PsiToDocumentationTranslator>()
diff --git a/core/src/main/kotlin/plugability/DefaultExtensions.kt b/core/src/main/kotlin/plugability/DefaultExtensions.kt
deleted file mode 100644
index 798e0f1a..00000000
--- a/core/src/main/kotlin/plugability/DefaultExtensions.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.jetbrains.dokka.plugability
-
-import org.jetbrains.dokka.CoreExtensions
-
-internal object DefaultExtensions {
-
-
- @Suppress("IMPLICIT_CAST_TO_ANY", "UNCHECKED_CAST")
- internal fun <T : Any, E : ExtensionPoint<T>> get(point: E, fullContext: DokkaContext): List<T> =
- when (point) {
- else -> null
- }.let { listOfNotNull( it ) as List<T> }
-} \ No newline at end of file
diff --git a/core/src/main/kotlin/plugability/DokkaContext.kt b/core/src/main/kotlin/plugability/DokkaContext.kt
index bcf6e1e0..5d5a8ebf 100644
--- a/core/src/main/kotlin/plugability/DokkaContext.kt
+++ b/core/src/main/kotlin/plugability/DokkaContext.kt
@@ -14,7 +14,7 @@ import kotlin.reflect.full.createInstance
interface DokkaContext {
fun <T : DokkaPlugin> plugin(kclass: KClass<T>): T?
- operator fun <T, E> get(point: E, askDefault: AskDefault = AskDefault.WhenEmpty): List<T>
+ operator fun <T, E> get(point: E): List<T>
where T : Any, E : ExtensionPoint<T>
fun <T, E> single(point: E): T where T : Any, E : ExtensionPoint<T>
@@ -94,13 +94,8 @@ private class DokkaContextConfigurationImpl(
}
@Suppress("UNCHECKED_CAST")
- override operator fun <T, E> get(point: E, askDefault: AskDefault) where T : Any, E : ExtensionPoint<T> =
- when (askDefault) {
- AskDefault.Never -> actions(point).orEmpty()
- AskDefault.Always -> actions(point).orEmpty() + DefaultExtensions.get(point, this)
- AskDefault.WhenEmpty ->
- actions(point)?.takeIf { it.isNotEmpty() } ?: DefaultExtensions.get(point, this)
- } as List<T>
+ override operator fun <T, E> get(point: E) where T : Any, E : ExtensionPoint<T> =
+ actions(point).orEmpty() as List<T>
@Suppress("UNCHECKED_CAST")
override fun <T, E> single(point: E): T where T : Any, E : ExtensionPoint<T> {
@@ -110,7 +105,7 @@ private class DokkaContextConfigurationImpl(
val extensions = extensions[point].orEmpty() as List<Extension<T>>
return when (extensions.size) {
- 0 -> DefaultExtensions.get(point, this).single() ?: throwBadArity("none was")
+ 0 -> throwBadArity("none was")
1 -> extensions.single().action.get(this)
else -> {
val notFallbacks = extensions.filterNot { it.isFallback }
@@ -166,7 +161,3 @@ private fun checkClasspath(classLoader: URLClassLoader) {
)
}
}
-
-enum class AskDefault {
- Always, Never, WhenEmpty
-} \ No newline at end of file
diff --git a/plugins/base/src/main/kotlin/renderers/FileWriter.kt b/plugins/base/src/main/kotlin/renderers/FileWriter.kt
index 5d3067fc..6519a4af 100644
--- a/plugins/base/src/main/kotlin/renderers/FileWriter.kt
+++ b/plugins/base/src/main/kotlin/renderers/FileWriter.kt
@@ -1,7 +1,6 @@
package org.jetbrains.dokka.base.renderers
import org.jetbrains.dokka.plugability.DokkaContext
-import org.jetbrains.dokka.renderers.OutputWriter
import java.io.File
import java.io.IOException
import java.net.URI