diff options
| author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2023-08-31 20:16:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-31 20:16:01 +0200 |
| commit | 02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33 (patch) | |
| tree | 66f6d6f089a93b863bf1144666491eca6729ad05 /core | |
| parent | 6a181a7a2b03ec263788d137610e86937a57d434 (diff) | |
| download | dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.gz dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.bz2 dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.zip | |
Enable explicit API mode (#3139)
Diffstat (limited to 'core')
69 files changed, 1127 insertions, 989 deletions
diff --git a/core/api/core.api b/core/api/core.api index 6da499ee..2399880b 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -658,7 +658,7 @@ public final class org/jetbrains/dokka/model/ActualTypealias : org/jetbrains/dok public final class org/jetbrains/dokka/model/ActualTypealias$Companion : org/jetbrains/dokka/model/properties/ExtraProperty$Key { public synthetic fun mergeStrategyFor (Ljava/lang/Object;Ljava/lang/Object;)Lorg/jetbrains/dokka/model/properties/MergeStrategy; - public fun mergeStrategyFor (Lorg/jetbrains/dokka/model/ActualTypealias;Lorg/jetbrains/dokka/model/ActualTypealias;)Lorg/jetbrains/dokka/model/properties/MergeStrategy$Fail; + public fun mergeStrategyFor (Lorg/jetbrains/dokka/model/ActualTypealias;Lorg/jetbrains/dokka/model/ActualTypealias;)Lorg/jetbrains/dokka/model/properties/MergeStrategy; } public final class org/jetbrains/dokka/model/AdditionalExtrasKt { @@ -817,7 +817,7 @@ public final class org/jetbrains/dokka/model/CheckedExceptions : org/jetbrains/d public final class org/jetbrains/dokka/model/CheckedExceptions$Companion : org/jetbrains/dokka/model/properties/ExtraProperty$Key { public synthetic fun mergeStrategyFor (Ljava/lang/Object;Ljava/lang/Object;)Lorg/jetbrains/dokka/model/properties/MergeStrategy; - public fun mergeStrategyFor (Lorg/jetbrains/dokka/model/CheckedExceptions;Lorg/jetbrains/dokka/model/CheckedExceptions;)Lorg/jetbrains/dokka/model/properties/MergeStrategy$Replace; + public fun mergeStrategyFor (Lorg/jetbrains/dokka/model/CheckedExceptions;Lorg/jetbrains/dokka/model/CheckedExceptions;)Lorg/jetbrains/dokka/model/properties/MergeStrategy; } public abstract interface class org/jetbrains/dokka/model/ClassKind { @@ -1505,7 +1505,7 @@ public final class org/jetbrains/dokka/model/ExceptionInSupertypes : org/jetbrai public final class org/jetbrains/dokka/model/ExceptionInSupertypes$Companion : org/jetbrains/dokka/model/properties/ExtraProperty$Key { public synthetic fun mergeStrategyFor (Ljava/lang/Object;Ljava/lang/Object;)Lorg/jetbrains/dokka/model/properties/MergeStrategy; - public fun mergeStrategyFor (Lorg/jetbrains/dokka/model/ExceptionInSupertypes;Lorg/jetbrains/dokka/model/ExceptionInSupertypes;)Lorg/jetbrains/dokka/model/properties/MergeStrategy$Replace; + public fun mergeStrategyFor (Lorg/jetbrains/dokka/model/ExceptionInSupertypes;Lorg/jetbrains/dokka/model/ExceptionInSupertypes;)Lorg/jetbrains/dokka/model/properties/MergeStrategy; } public abstract interface class org/jetbrains/dokka/model/Expression { @@ -1707,7 +1707,7 @@ public final class org/jetbrains/dokka/model/ImplementedInterfaces : org/jetbrai public final class org/jetbrains/dokka/model/ImplementedInterfaces$Companion : org/jetbrains/dokka/model/properties/ExtraProperty$Key { public synthetic fun mergeStrategyFor (Ljava/lang/Object;Ljava/lang/Object;)Lorg/jetbrains/dokka/model/properties/MergeStrategy; - public fun mergeStrategyFor (Lorg/jetbrains/dokka/model/ImplementedInterfaces;Lorg/jetbrains/dokka/model/ImplementedInterfaces;)Lorg/jetbrains/dokka/model/properties/MergeStrategy$Replace; + public fun mergeStrategyFor (Lorg/jetbrains/dokka/model/ImplementedInterfaces;Lorg/jetbrains/dokka/model/ImplementedInterfaces;)Lorg/jetbrains/dokka/model/properties/MergeStrategy; } public final class org/jetbrains/dokka/model/InheritedMember : org/jetbrains/dokka/model/properties/ExtraProperty { @@ -1726,7 +1726,7 @@ public final class org/jetbrains/dokka/model/InheritedMember : org/jetbrains/dok public final class org/jetbrains/dokka/model/InheritedMember$Companion : org/jetbrains/dokka/model/properties/ExtraProperty$Key { public synthetic fun mergeStrategyFor (Ljava/lang/Object;Ljava/lang/Object;)Lorg/jetbrains/dokka/model/properties/MergeStrategy; - public fun mergeStrategyFor (Lorg/jetbrains/dokka/model/InheritedMember;Lorg/jetbrains/dokka/model/InheritedMember;)Lorg/jetbrains/dokka/model/properties/MergeStrategy$Replace; + public fun mergeStrategyFor (Lorg/jetbrains/dokka/model/InheritedMember;Lorg/jetbrains/dokka/model/InheritedMember;)Lorg/jetbrains/dokka/model/properties/MergeStrategy; } public final class org/jetbrains/dokka/model/IntValue : org/jetbrains/dokka/model/LiteralValue { @@ -4103,8 +4103,7 @@ public final class org/jetbrains/dokka/pages/MultimoduleRootPageNode : org/jetbr public fun getName ()Ljava/lang/String; public synthetic fun modified (Ljava/lang/String;Ljava/util/List;)Lorg/jetbrains/dokka/pages/PageNode; public fun modified (Ljava/lang/String;Ljava/util/List;)Lorg/jetbrains/dokka/pages/RootPageNode; - public synthetic fun modified (Ljava/lang/String;Lorg/jetbrains/dokka/pages/ContentNode;Ljava/util/Set;Ljava/util/List;Ljava/util/List;)Lorg/jetbrains/dokka/pages/ContentPage; - public fun modified (Ljava/lang/String;Lorg/jetbrains/dokka/pages/ContentNode;Ljava/util/Set;Ljava/util/List;Ljava/util/List;)Lorg/jetbrains/dokka/pages/MultimoduleRootPageNode; + public fun modified (Ljava/lang/String;Lorg/jetbrains/dokka/pages/ContentNode;Ljava/util/Set;Ljava/util/List;Ljava/util/List;)Lorg/jetbrains/dokka/pages/ContentPage; } public final class org/jetbrains/dokka/pages/MultimoduleTable : org/jetbrains/dokka/pages/Style { @@ -4166,7 +4165,7 @@ public final class org/jetbrains/dokka/pages/PlatformHintedContent : org/jetbrai public synthetic fun transformChildren (Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/dokka/pages/ContentComposite; public fun transformChildren (Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/dokka/pages/PlatformHintedContent; public synthetic fun withNewExtras (Lorg/jetbrains/dokka/model/properties/PropertyContainer;)Ljava/lang/Object; - public fun withNewExtras (Lorg/jetbrains/dokka/model/properties/PropertyContainer;)Ljava/lang/Void; + public fun withNewExtras (Lorg/jetbrains/dokka/model/properties/PropertyContainer;)Lorg/jetbrains/dokka/pages/ContentNode; public synthetic fun withSourceSets (Ljava/util/Set;)Lorg/jetbrains/dokka/pages/ContentNode; public fun withSourceSets (Ljava/util/Set;)Lorg/jetbrains/dokka/pages/PlatformHintedContent; } diff --git a/core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt b/core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt index 5a8de9ce..026f7b6b 100644 --- a/core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt +++ b/core/content-matcher-test-utils/src/main/kotlin/matchers/content/ContentMatchersDsl.kt @@ -12,7 +12,7 @@ import kotlin.test.assertEquals import kotlin.test.asserter // entry point: -fun ContentNode.assertNode(block: ContentMatcherBuilder<ContentComposite>.() -> Unit) { +public fun ContentNode.assertNode(block: ContentMatcherBuilder<ContentComposite>.() -> Unit) { val matcher = ContentMatcherBuilder(ContentComposite::class).apply(block).build() try { matcher.tryMatch(this) @@ -24,123 +24,161 @@ fun ContentNode.assertNode(block: ContentMatcherBuilder<ContentComposite>.() -> // DSL: @DslMarker -annotation class ContentMatchersDsl +public annotation class ContentMatchersDsl @ContentMatchersDsl -class ContentMatcherBuilder<T : ContentComposite> @PublishedApi internal constructor(private val kclass: KClass<T>) { +public class ContentMatcherBuilder<T : ContentComposite> @PublishedApi internal constructor(private val kclass: KClass<T>) { @PublishedApi - internal val children = mutableListOf<MatcherElement>() + internal val children: MutableList<MatcherElement> = mutableListOf() internal val assertions = mutableListOf<T.() -> Unit>() - fun build() = CompositeMatcher(kclass, childrenOrSkip()) { assertions.forEach { it() } } + public fun build(): CompositeMatcher<T> = CompositeMatcher(kclass, childrenOrSkip()) { assertions.forEach { it() } } // part of DSL that cannot be defined as an extension - operator fun String.unaryPlus() { + public operator fun String.unaryPlus() { children += TextMatcher(this) } private fun childrenOrSkip() = if (children.isEmpty() && assertions.isNotEmpty()) listOf(Anything) else children } -fun <T : ContentComposite> ContentMatcherBuilder<T>.check(assertion: T.() -> Unit) { +public fun <T : ContentComposite> ContentMatcherBuilder<T>.check(assertion: T.() -> Unit) { assertions += assertion } private val ContentComposite.extractedText get() = withDescendants().filterIsInstance<ContentText>().joinToString(separator = "") { it.text } -fun <T : ContentComposite> ContentMatcherBuilder<T>.hasExactText(expected: String) { +public fun <T : ContentComposite> ContentMatcherBuilder<T>.hasExactText(expected: String) { assertions += { assertEquals(expected, this.extractedText) } } -inline fun <reified S : ContentComposite> ContentMatcherBuilder<*>.composite( +public inline fun <reified S : ContentComposite> ContentMatcherBuilder<*>.composite( block: ContentMatcherBuilder<S>.() -> Unit ) { children += ContentMatcherBuilder(S::class).apply(block).build() } -inline fun <reified S : ContentNode> ContentMatcherBuilder<*>.node(noinline assertions: S.() -> Unit = {}) { +public inline fun <reified S : ContentNode> ContentMatcherBuilder<*>.node(noinline assertions: S.() -> Unit = {}) { children += NodeMatcher(S::class, assertions) } -fun ContentMatcherBuilder<*>.skipAllNotMatching() { +public fun ContentMatcherBuilder<*>.skipAllNotMatching() { children += Anything } // Convenience functions: -fun ContentMatcherBuilder<*>.group(block: ContentMatcherBuilder<ContentGroup>.() -> Unit) = composite(block) +public fun ContentMatcherBuilder<*>.group(block: ContentMatcherBuilder<ContentGroup>.() -> Unit) { + composite(block) +} -fun ContentMatcherBuilder<*>.tabbedGroup( +public fun ContentMatcherBuilder<*>.tabbedGroup( block: ContentMatcherBuilder<ContentGroup>.() -> Unit -) = composite<ContentGroup> { - block() - check { assertContains(this.style, ContentStyle.TabbedContent) } +) { + composite<ContentGroup> { + block() + check { assertContains(this.style, ContentStyle.TabbedContent) } + } } -fun ContentMatcherBuilder<*>.tab( +public fun ContentMatcherBuilder<*>.tab( tabbedContentType: TabbedContentType, block: ContentMatcherBuilder<ContentGroup>.() -> Unit -) = composite<ContentGroup> { - block() - check { - assertEquals(tabbedContentType, this.extra[TabbedContentTypeExtra]?.value) +) { + composite<ContentGroup> { + block() + check { + assertEquals(tabbedContentType, this.extra[TabbedContentTypeExtra]?.value) + } } } -fun ContentMatcherBuilder<*>.header(expectedLevel: Int? = null, block: ContentMatcherBuilder<ContentHeader>.() -> Unit) = +public fun ContentMatcherBuilder<*>.header(expectedLevel: Int? = null, block: ContentMatcherBuilder<ContentHeader>.() -> Unit) { composite<ContentHeader> { block() check { if (expectedLevel != null) assertEquals(expectedLevel, this.level) } } +} -fun ContentMatcherBuilder<*>.p(block: ContentMatcherBuilder<ContentGroup>.() -> Unit) = +public fun ContentMatcherBuilder<*>.p(block: ContentMatcherBuilder<ContentGroup>.() -> Unit) { composite<ContentGroup> { block() check { assertContains(this.style, TextStyle.Paragraph) } } +} -fun ContentMatcherBuilder<*>.link(block: ContentMatcherBuilder<ContentLink>.() -> Unit) = composite(block) +public fun ContentMatcherBuilder<*>.link(block: ContentMatcherBuilder<ContentLink>.() -> Unit) { + composite(block) +} -fun ContentMatcherBuilder<*>.table(block: ContentMatcherBuilder<ContentTable>.() -> Unit) = composite(block) +public fun ContentMatcherBuilder<*>.table(block: ContentMatcherBuilder<ContentTable>.() -> Unit) { + composite(block) +} -fun ContentMatcherBuilder<*>.platformHinted(block: ContentMatcherBuilder<ContentGroup>.() -> Unit) = +public fun ContentMatcherBuilder<*>.platformHinted(block: ContentMatcherBuilder<ContentGroup>.() -> Unit) { composite<PlatformHintedContent> { group(block) } +} -fun ContentMatcherBuilder<*>.list(block: ContentMatcherBuilder<ContentList>.() -> Unit) = composite(block) +public fun ContentMatcherBuilder<*>.list(block: ContentMatcherBuilder<ContentList>.() -> Unit) { + composite(block) +} -fun ContentMatcherBuilder<*>.codeBlock(block: ContentMatcherBuilder<ContentCodeBlock>.() -> Unit) = composite(block) +public fun ContentMatcherBuilder<*>.codeBlock(block: ContentMatcherBuilder<ContentCodeBlock>.() -> Unit) { + composite(block) +} -fun ContentMatcherBuilder<*>.codeInline(block: ContentMatcherBuilder<ContentCodeInline>.() -> Unit) = composite(block) +public fun ContentMatcherBuilder<*>.codeInline(block: ContentMatcherBuilder<ContentCodeInline>.() -> Unit) { + composite(block) +} -fun ContentMatcherBuilder<*>.caption(block: ContentMatcherBuilder<ContentGroup>.() -> Unit) = composite<ContentGroup> { - block() - check { assertContains(this.style, ContentStyle.Caption) } +public fun ContentMatcherBuilder<*>.caption(block: ContentMatcherBuilder<ContentGroup>.() -> Unit) { + composite<ContentGroup> { + block() + check { assertContains(this.style, ContentStyle.Caption) } + } } -fun ContentMatcherBuilder<*>.br() = node<ContentBreakLine>() +public fun ContentMatcherBuilder<*>.br() { + node<ContentBreakLine>() +} -fun ContentMatcherBuilder<*>.somewhere(block: ContentMatcherBuilder<*>.() -> Unit) { +public fun ContentMatcherBuilder<*>.somewhere(block: ContentMatcherBuilder<*>.() -> Unit) { skipAllNotMatching() block() skipAllNotMatching() } -fun ContentMatcherBuilder<*>.divergentGroup(block: ContentMatcherBuilder<ContentDivergentGroup>.() -> Unit) = +public fun ContentMatcherBuilder<*>.divergentGroup( + block: ContentMatcherBuilder<ContentDivergentGroup>.() -> Unit +) { composite(block) +} -fun ContentMatcherBuilder<ContentDivergentGroup>.divergentInstance(block: ContentMatcherBuilder<ContentDivergentInstance>.() -> Unit) = +public fun ContentMatcherBuilder<ContentDivergentGroup>.divergentInstance( + block: ContentMatcherBuilder<ContentDivergentInstance>.() -> Unit +) { composite(block) +} -fun ContentMatcherBuilder<ContentDivergentInstance>.before(block: ContentMatcherBuilder<ContentComposite>.() -> Unit) = +public fun ContentMatcherBuilder<ContentDivergentInstance>.before( + block: ContentMatcherBuilder<ContentComposite>.() -> Unit +) { composite(block) +} -fun ContentMatcherBuilder<ContentDivergentInstance>.divergent(block: ContentMatcherBuilder<ContentComposite>.() -> Unit) = +public fun ContentMatcherBuilder<ContentDivergentInstance>.divergent( + block: ContentMatcherBuilder<ContentComposite>.() -> Unit +) { composite(block) +} -fun ContentMatcherBuilder<ContentDivergentInstance>.after(block: ContentMatcherBuilder<ContentComposite>.() -> Unit) = +public fun ContentMatcherBuilder<ContentDivergentInstance>.after( + block: ContentMatcherBuilder<ContentComposite>.() -> Unit +) { composite(block) +} /* * TODO replace with kotlin.test.assertContains after migrating to Kotlin language version 1.5+ diff --git a/core/content-matcher-test-utils/src/main/kotlin/matchers/content/contentMatchers.kt b/core/content-matcher-test-utils/src/main/kotlin/matchers/content/contentMatchers.kt index a6549b31..412f728b 100644 --- a/core/content-matcher-test-utils/src/main/kotlin/matchers/content/contentMatchers.kt +++ b/core/content-matcher-test-utils/src/main/kotlin/matchers/content/contentMatchers.kt @@ -14,15 +14,18 @@ import kotlin.reflect.KClass import kotlin.reflect.full.cast import kotlin.reflect.full.safeCast -sealed class MatcherElement +public sealed class MatcherElement -class TextMatcher(val text: String) : MatcherElement() +public class TextMatcher( + public val text: String +) : MatcherElement() -open class NodeMatcher<T : ContentNode>( - val kclass: KClass<T>, - val assertions: T.() -> Unit = {} +public open class NodeMatcher<T : ContentNode>( + public val kclass: KClass<T>, + public val assertions: T.() -> Unit = {} ) : MatcherElement() { - open fun tryMatch(node: ContentNode) { + + public open fun tryMatch(node: ContentNode) { kclass.safeCast(node)?.apply { try { |
