aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2023-08-28 19:42:21 +0300
committerGitHub <noreply@github.com>2023-08-28 19:42:21 +0300
commit0e00edc6fcd406fcf38673ef6a2f8f59e8374de2 (patch)
tree697b0de0d44b421c922f1f5e6a7c1352f17c68a6 /plugins
parentbec2cac91726e52884329e7997207e9777abaab7 (diff)
downloaddokka-0e00edc6fcd406fcf38673ef6a2f8f59e8374de2.tar.gz
dokka-0e00edc6fcd406fcf38673ef6a2f8f59e8374de2.tar.bz2
dokka-0e00edc6fcd406fcf38673ef6a2f8f59e8374de2.zip
Support Dokka K2 analysis (#3094)
Dokka has its own documentable model to represent analyzed code. The analysis is performed by a compiler frontend. In K1 the compiler frontend has descriptors that use the underlying Binding Context (global shared stateful structure). Dokka just maps descriptors to Documentable by DefaultDescriptorToDocumentableTranslator. K2 compiler has FIR tree, which means “Frontend Intermediate Representation”, instead of Binding Context. But we do not use FIR in Dokka directly, since it is too low-level for analysis. The Kotlin compiler provides high-level Analysis API for this case. The API is used by KSP too. Analysis API represent elements of FIR (declarations, parameters and so on) as Symbols. For more details see KtSymbolByFirBuilder, KtSymbol. For Dokka symbol is the replacement of descriptor in K2. Also, to set up the environment of project analysis in K1 we use idea dependencies (or copy-past from there). In K2 for these aims, there is a Standalone mode for Analysis API.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/android-documentation/build.gradle.kts8
-rw-r--r--plugins/base/base-test-utils/build.gradle.kts1
-rw-r--r--plugins/base/build.gradle.kts13
-rw-r--r--plugins/base/src/test/kotlin/basic/DRITest.kt1
-rw-r--r--plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt6
-rw-r--r--plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt5
-rw-r--r--plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt10
-rw-r--r--plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt3
-rw-r--r--plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt3
-rw-r--r--plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/markdown/LinkTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/markdown/ParserTest.kt8
-rw-r--r--plugins/base/src/test/kotlin/model/ClassesTest.kt7
-rw-r--r--plugins/base/src/test/kotlin/model/ExtensionsTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/model/FunctionsTest.kt7
-rw-r--r--plugins/base/src/test/kotlin/model/JavaTest.kt5
-rw-r--r--plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/NavigationIconTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt3
-rw-r--r--plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt7
-rw-r--r--plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt13
-rw-r--r--plugins/base/src/test/kotlin/signatures/SignatureTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt3
-rw-r--r--plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/transformers/ObviousAndInheritedFunctionsDocumentableFilterTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/transformers/isExceptionTest.kt8
-rw-r--r--plugins/base/src/test/kotlin/translators/Bug1341.kt2
-rw-r--r--plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/translators/ExternalDocumentablesTest.kt7
-rw-r--r--plugins/base/src/test/kotlin/translators/JavadocInheritDocsTest.kt3
-rw-r--r--plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/translators/JavadocParserTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/utils/TagsAnnotations.kt71
-rw-r--r--plugins/mathjax/build.gradle.kts8
47 files changed, 224 insertions, 34 deletions
diff --git a/plugins/android-documentation/build.gradle.kts b/plugins/android-documentation/build.gradle.kts
index 4dfc972d..545f8435 100644
--- a/plugins/android-documentation/build.gradle.kts
+++ b/plugins/android-documentation/build.gradle.kts
@@ -3,6 +3,7 @@ import org.jetbrains.registerDokkaArtifactPublication
plugins {
id("org.jetbrains.conventions.kotlin-jvm")
id("org.jetbrains.conventions.maven-publish")
+ id("org.jetbrains.conventions.base-unit-test")
}
dependencies {
@@ -13,10 +14,15 @@ dependencies {
implementation(kotlin("reflect"))
testImplementation(projects.plugins.base)
- testImplementation(projects.plugins.base.baseTestUtils)
testImplementation(projects.core.testApi)
testImplementation(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter)
+
+ symbolsTestConfiguration(project(path = ":subprojects:analysis-kotlin-symbols", configuration = "shadow"))
+ descriptorsTestConfiguration(project(path = ":subprojects:analysis-kotlin-descriptors", configuration = "shadow"))
+ testImplementation(projects.plugins.base.baseTestUtils) {
+ exclude(module = "analysis-kotlin-descriptors")
+ }
}
registerDokkaArtifactPublication("androidDocumentationPlugin") {
diff --git a/plugins/base/base-test-utils/build.gradle.kts b/plugins/base/base-test-utils/build.gradle.kts
index ef4f9f7b..20c3b727 100644
--- a/plugins/base/base-test-utils/build.gradle.kts
+++ b/plugins/base/base-test-utils/build.gradle.kts
@@ -12,6 +12,7 @@ dependencies {
api(projects.subprojects.analysisKotlinApi)
// TODO [beresnev] analysis switcher
+ //runtimeOnly(project(path = ":subprojects:analysis-kotlin-symbols", configuration = "shadow"))
runtimeOnly(project(path = ":subprojects:analysis-kotlin-descriptors", configuration = "shadow"))
implementation(kotlin("reflect"))
diff --git a/plugins/base/build.gradle.kts b/plugins/base/build.gradle.kts
index 8bea63e8..2f9f5863 100644
--- a/plugins/base/build.gradle.kts
+++ b/plugins/base/build.gradle.kts
@@ -4,6 +4,7 @@ plugins {
id("org.jetbrains.conventions.kotlin-jvm")
id("org.jetbrains.conventions.maven-publish")
id("org.jetbrains.conventions.dokka-html-frontend-files")
+ id("org.jetbrains.conventions.base-unit-test")
}
dependencies {
@@ -26,7 +27,11 @@ dependencies {
}
// Test only
- testImplementation(projects.plugins.base.baseTestUtils)
+ symbolsTestConfiguration(project(path = ":subprojects:analysis-kotlin-symbols", configuration = "shadow"))
+ descriptorsTestConfiguration(project(path = ":subprojects:analysis-kotlin-descriptors", configuration = "shadow"))
+ testImplementation(projects.plugins.base.baseTestUtils) {
+ exclude(module = "analysis-kotlin-descriptors")
+ }
testImplementation(projects.core.contentMatcherTestUtils)
testImplementation(projects.core.testApi)
testImplementation(platform(libs.junit.bom))
@@ -37,6 +42,12 @@ dependencies {
}
}
+
+
+
+
+
+
// access the frontend files via the dependency on :plugins:base:frontend
val dokkaHtmlFrontendFiles: Provider<FileCollection> =
configurations.dokkaHtmlFrontendFiles.map { frontendFiles ->
diff --git a/plugins/base/src/test/kotlin/basic/DRITest.kt b/plugins/base/src/test/kotlin/basic/DRITest.kt
index 9c443567..c70c1b0b 100644
--- a/plugins/base/src/test/kotlin/basic/DRITest.kt
+++ b/plugins/base/src/test/kotlin/basic/DRITest.kt
@@ -10,6 +10,7 @@ import org.jetbrains.dokka.pages.ClasslikePageNode
import org.jetbrains.dokka.pages.ContentPage
import org.jetbrains.dokka.pages.MemberPageNode
import org.junit.jupiter.api.Assertions.assertEquals
+import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test
class DRITest : BaseAbstractTest() {
diff --git a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt
index 46239baa..82159e0d 100644
--- a/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt
+++ b/plugins/base/src/test/kotlin/content/annotations/ContentForAnnotationsTest.kt
@@ -10,10 +10,7 @@ import org.jetbrains.dokka.pages.ContentText
import org.jetbrains.dokka.pages.MemberPageNode
import org.jetbrains.dokka.pages.PackagePageNode
import org.junit.jupiter.api.Test
-import utils.ParamAttributes
-import utils.assertNotNull
-import utils.bareSignature
-import utils.propertySignature
+import utils.*
import kotlin.test.assertEquals
import kotlin.test.assertTrue
@@ -318,6 +315,7 @@ class ContentForAnnotationsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `annotated bounds in Java`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt b/plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt
index 961ce5f5..c25c1a1b 100644
--- a/plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt
+++ b/plugins/base/src/test/kotlin/content/annotations/JavaDeprecatedTest.kt
@@ -9,10 +9,12 @@ import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.jetbrains.dokka.pages.ContentPage
import org.jetbrains.dokka.pages.ContentStyle
import org.junit.jupiter.api.Test
+import utils.JavaCode
import utils.pWrapped
import kotlin.test.assertEquals
import kotlin.test.assertTrue
+@JavaCode
class JavaDeprecatedTest : BaseAbstractTest() {
private val testConfiguration = dokkaConfiguration {
diff --git a/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt b/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt
index 14a36611..17bd209e 100644
--- a/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt
+++ b/plugins/base/src/test/kotlin/content/exceptions/ContentForExceptions.kt
@@ -7,9 +7,7 @@ import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.model.DisplaySourceSet
import org.junit.jupiter.api.Test
-import utils.ParamAttributes
-import utils.bareSignature
-import utils.findTestType
+import utils.*
import kotlin.test.assertEquals
class ContentForExceptions : BaseAbstractTest() {
@@ -55,6 +53,7 @@ class ContentForExceptions : BaseAbstractTest() {
)
}
+ @OnlyDescriptors("Fixed in 1.9.20 (IMPORT STAR)")
@Test
fun `function with navigatable thrown exception`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt b/plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt
index e5059073..2994fb42 100644
--- a/plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt
+++ b/plugins/base/src/test/kotlin/content/inheritors/ContentForInheritorsTest.kt
@@ -6,6 +6,7 @@ import org.jetbrains.dokka.PluginConfigurationImpl
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.junit.jupiter.api.Test
+import utils.OnlyDescriptors
import utils.classSignature
import utils.findTestType
import kotlin.test.assertEquals
@@ -128,6 +129,7 @@ class ContentForInheritorsTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("Order of inheritors is different in K2")
@Test
fun `interface with few inheritors has table in description`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
index e74cb49d..df5efd03 100644
--- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
+++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
@@ -242,6 +242,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `deprecated with multiple links inside`() {
testInline(
@@ -346,6 +347,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `deprecated with an multiple inline links`() {
testInline(
@@ -410,6 +412,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `multiline throws with comment`() {
testInline(
@@ -473,6 +476,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("Fixed in 1.9.20 (IMPORT STAR)")
@Test
fun `multiline kotlin throws with comment`() {
testInline(
@@ -590,6 +594,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `multiline throws where exception is not in the same line as description`() {
testInline(
@@ -673,6 +678,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
+ @JavaCode
@Test
fun `documentation splitted in 2 using enters`() {
testInline(
@@ -718,6 +724,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `multiline return tag with param`() {
testInline(
@@ -783,6 +790,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @UsingJDK
@Test
fun `return tag in kotlin`() {
testInline(
@@ -830,6 +838,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `list with links and description`() {
testInline(
@@ -1476,6 +1485,7 @@ class ContentForParamsTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun javaDocCommentWithDocumentedParameters() {
testInline(
diff --git a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
index 79c1e1ad..82a04b89 100644
--- a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
+++ b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
@@ -171,6 +171,7 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("No link for `abc` in K1")
@Test
fun `undocumented seealso with reference to parameter for class`() {
testInline(
@@ -201,7 +202,7 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
header(4) { +"See also" }
table {
group {
- +"abc"
+ +"abc" // link { +"abc" }
}
}
}
@@ -751,6 +752,7 @@ class ContentForSeeAlsoTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptorsMPP
@Test
fun `multiplatform class with seealso in few platforms`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt b/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt
index 0cf94c18..e57e6a8c 100644
--- a/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt
+++ b/plugins/base/src/test/kotlin/content/signatures/ConstructorsSignaturesTest.kt
@@ -5,6 +5,7 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.pages.BasicTabbedContentType
import org.jetbrains.dokka.pages.ContentPage
import org.junit.jupiter.api.Test
+import utils.OnlyDescriptors
class ConstructorsSignaturesTest : BaseAbstractTest() {
private val testConfiguration = dokkaConfiguration {
@@ -157,6 +158,7 @@ class ConstructorsSignaturesTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("Order of constructors is different in K2")
@Test
fun `class with a parameterless secondary constructor`() {
testInline(
@@ -227,6 +229,7 @@ class ConstructorsSignaturesTest : BaseAbstractTest() {
}
+ @OnlyDescriptors("Order of constructors is different in K2")
@Test
fun `class with a few documented constructors`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt b/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt
index efab9aba..6423655a 100644
--- a/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt
+++ b/plugins/base/src/test/kotlin/filter/JavaVisibilityFilterTest.kt
@@ -11,8 +11,10 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource
import testApi.testRunner.dokkaConfiguration
+import utils.JavaCode
import kotlin.test.assertEquals
+@JavaCode
class JavaVisibilityFilterTest : BaseAbstractTest() {
@Test
diff --git a/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt b/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt
index f4ef85b9..af77d61c 100644
--- a/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt
+++ b/plugins/base/src/test/kotlin/filter/KotlinArrayDocumentableReplacerTest.kt
@@ -8,6 +8,7 @@ import org.jetbrains.dokka.model.GenericTypeConstructor
import org.jetbrains.dokka.model.Invariance
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
+import utils.OnlyDescriptors
class KotlinArrayDocumentableReplacerTest : BaseAbstractTest() {
private val configuration = dokkaConfiguration {
@@ -157,6 +158,8 @@ class KotlinArrayDocumentableReplacerTest : BaseAbstractTest() {
}
}
}
+
+ @OnlyDescriptors("Fix module.contentScope in new Standalone API") // TODO fix module.contentScope [getKtModuleForKtElement]
@Test
fun `no jvm source set`() {
val configurationWithNoJVM = dokkaConfiguration {
diff --git a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
index be75e01f..ccf62641 100644
--- a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
+++ b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt
@@ -10,6 +10,8 @@ import org.jetbrains.dokka.pages.*
import org.jsoup.Jsoup
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
+import utils.OnlyDescriptors
+import utils.OnlyDescriptorsMPP
import utils.TestOutputWriterPlugin
import utils.assertNotNull
import java.net.URL
@@ -18,6 +20,7 @@ import kotlin.test.assertEquals
class LinkableContentTest : BaseAbstractTest() {
+ @OnlyDescriptorsMPP
@Test
fun `Include module and package documentation`() {
@@ -143,6 +146,7 @@ class LinkableContentTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptorsMPP
@Test
fun `Samples multiplatform documentation`() {
diff --git a/plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt b/plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt
index 14875832..9ba428d6 100644
--- a/plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt
+++ b/plugins/base/src/test/kotlin/linking/EnumValuesLinkingTest.kt
@@ -11,11 +11,13 @@ import org.jsoup.Jsoup
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Test
+import utils.OnlyDescriptors
import utils.TestOutputWriterPlugin
import java.nio.file.Paths
class EnumValuesLinkingTest : BaseAbstractTest() {
+ @OnlyDescriptors // TODO
@Test
fun `check if enum values are correctly linked`() {
val writerPlugin = TestOutputWriterPlugin()
diff --git a/plugins/base/src/test/kotlin/markdown/LinkTest.kt b/plugins/base/src/test/kotlin/markdown/LinkTest.kt
index 526ff0eb..8ee5a20d 100644
--- a/plugins/base/src/test/kotlin/markdown/LinkTest.kt
+++ b/plugins/base/src/test/kotlin/markdown/LinkTest.kt
@@ -11,8 +11,10 @@ import org.jetbrains.dokka.pages.MemberPageNode
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Test
+import utils.UsingJDK
class LinkTest : BaseAbstractTest() {
+ @UsingJDK
@Test
fun linkToClassLoader() {
val configuration = dokkaConfiguration {
diff --git a/plugins/base/src/test/kotlin/markdown/ParserTest.kt b/plugins/base/src/test/kotlin/markdown/ParserTest.kt
index 41b086ee..e10a2260 100644
--- a/plugins/base/src/test/kotlin/markdown/ParserTest.kt
+++ b/plugins/base/src/test/kotlin/markdown/ParserTest.kt
@@ -1473,6 +1473,7 @@ class ParserTest : KDocTest() {
executeTest(kdoc, expectedDocumentationNode)
}
+
@Test
fun `exception thrown by empty header should point to location of a file`() {
val kdoc = """
@@ -1481,9 +1482,10 @@ class ParserTest : KDocTest() {
val expectedDocumentationNode = DocumentationNode(emptyList())
val exception = runCatching { executeTest(kdoc, expectedDocumentationNode) }.exceptionOrNull()
- assertEquals(
- "Wrong AST Tree. Header does not contain expected content in Test.kt/example.Test, element starts from offset 0 and ends 3: ###",
- exception?.message
+ val expectedMessage = "Wrong AST Tree. Header does not contain expected content in Test.kt/example.Test, element starts from offset 0 and ends 3: ###"
+ assert(
+ exception?.message == expectedMessage
+ || /* for K2 */ exception?.cause?.cause?.message == expectedMessage
)
}
diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt
index 807ede78..e358945e 100644
--- a/plugins/base/src/test/kotlin/model/ClassesTest.kt
+++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt
@@ -7,10 +7,7 @@ import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.KotlinModifier.*
import org.junit.jupiter.api.Assertions.assertNull
import org.junit.jupiter.api.Test
-import utils.AbstractModelTest
-import utils.assertNotNull
-import utils.name
-import utils.supers
+import utils.*
class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "classes") {
@@ -411,6 +408,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
}
}
+ @OnlyDescriptors("Bug in descriptors, DRI of entry should have [EnumEntryDRIExtra]")
@Test
fun javaAnnotationClass() {
inlineModelTest(
@@ -523,6 +521,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
}
}
+ @UsingJDK
@Test
fun doublyTypealiasedException() {
inlineModelTest(
diff --git a/plugins/base/src/test/kotlin/model/ExtensionsTest.kt b/plugins/base/src/test/kotlin/model/ExtensionsTest.kt
index e28b442f..b54f8deb 100644
--- a/plugins/base/src/test/kotlin/model/ExtensionsTest.kt
+++ b/plugins/base/src/test/kotlin/model/ExtensionsTest.kt
@@ -8,6 +8,7 @@ import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.properties.WithExtraProperties
import org.junit.jupiter.api.Test
import utils.AbstractModelTest
+import utils.UsingJDK
class ExtensionsTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "classes") {
private fun <T : WithExtraProperties<R>, R : Documentable> T.checkExtension(name: String = "extension") =
@@ -66,6 +67,7 @@ class ExtensionsTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "cl
}
}
+ @UsingJDK
@Test
fun `should be extension for external classes`() {
inlineModelTest(
@@ -85,7 +87,7 @@ class ExtensionsTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "cl
}
}
}
-
+
@Test
fun `should be extension for typealias`() {
inlineModelTest(
diff --git a/plugins/base/src/test/kotlin/model/FunctionsTest.kt b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
index fa65a477..3410f9ef 100644
--- a/plugins/base/src/test/kotlin/model/FunctionsTest.kt
+++ b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
@@ -3,10 +3,7 @@ package model
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.*
import org.junit.jupiter.api.Test
-import utils.AbstractModelTest
-import utils.assertNotNull
-import utils.comments
-import utils.name
+import utils.*
class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "function") {
@@ -213,6 +210,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
}
}
+ @OnlyDescriptors("Bug in descriptors, DRI of entry should have [EnumEntryDRIExtra]")
@Test
fun functionWithAnnotatedParam() {
inlineModelTest(
@@ -274,6 +272,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
}
}
+ @OnlyDescriptors("Bug in descriptors, DRI of entry should have [EnumEntryDRIExtra]")
@Test
fun annotatedFunctionWithAnnotationParameters() {
inlineModelTest(
diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt
index f57c3c8c..a0605a5e 100644
--- a/plugins/base/src/test/kotlin/model/JavaTest.kt
+++ b/plugins/base/src/test/kotlin/model/JavaTest.kt
@@ -9,12 +9,11 @@ import org.jetbrains.dokka.model.doc.Param
import org.jetbrains.dokka.model.doc.Text
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
-import utils.AbstractModelTest
+import utils.*
import utils.assertContains
-import utils.assertNotNull
-import utils.name
import kotlin.test.assertEquals
+@JavaCode
class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
val configuration = dokkaConfiguration {
sourceSets {
diff --git a/plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt b/plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt
index 5fe17fc8..6f08c89d 100644
--- a/plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt
+++ b/plugins/base/src/test/kotlin/model/MultiLanguageInheritanceTest.kt
@@ -9,9 +9,11 @@ import org.jetbrains.dokka.model.withDescendants
import org.jetbrains.dokka.utilities.firstIsInstanceOrNull
import org.junit.jupiter.api.Test
import translators.documentationOf
+import utils.JavaCode
import utils.docs
import kotlin.test.assertEquals
+@JavaCode
class MultiLanguageInheritanceTest : BaseAbstractTest() {
val configuration = dokkaConfiguration {
suppressObviousFunctions = false
diff --git a/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt b/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt
index d6564343..35997681 100644
--- a/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt
+++ b/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsForParametersTest.kt
@@ -6,9 +6,11 @@ import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.utilities.cast
import org.junit.jupiter.api.Test
import utils.AbstractModelTest
+import utils.JavaCode
import kotlin.test.assertEquals
import kotlin.test.assertTrue
+@JavaCode
class JavaAnnotationsForParametersTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
@Test
diff --git a/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsTest.kt b/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsTest.kt
index e704bf71..0abf504e 100644
--- a/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsTest.kt
+++ b/plugins/base/src/test/kotlin/model/annotations/JavaAnnotationsTest.kt
@@ -4,11 +4,13 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.model.*
import org.junit.jupiter.api.Test
import translators.findClasslike
+import utils.JavaCode
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
+@JavaCode
class JavaAnnotationsTest : BaseAbstractTest() {
val configuration = dokkaConfiguration {
diff --git a/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt b/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt
index f4615216..4b376c73 100644
--- a/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt
+++ b/plugins/base/src/test/kotlin/parsers/JavadocParserTest.kt
@@ -10,10 +10,12 @@ import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.utilities.firstIsInstanceOrNull
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
+import utils.JavaCode
import utils.docs
import utils.text
import kotlin.test.assertNotNull
+@JavaCode
class JavadocParserTest : BaseAbstractTest() {
private val configuration = dokkaConfiguration {
diff --git a/plugins/base/src/test/kotlin/renderers/html/NavigationIconTest.kt b/plugins/base/src/test/kotlin/renderers/html/NavigationIconTest.kt
index 5e2560bf..fb2c53cd 100644
--- a/plugins/base/src/test/kotlin/renderers/html/NavigationIconTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/NavigationIconTest.kt
@@ -3,6 +3,7 @@ package renderers.html
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.junit.jupiter.api.Test
import utils.TestOutputWriterPlugin
+import utils.UsingJDK
import utils.navigationHtml
import utils.selectNavigationGrid
import kotlin.test.assertEquals
@@ -182,6 +183,7 @@ class NavigationIconTest : BaseAbstractTest() {
)
}
+ @UsingJDK
@Test
fun `should add icon styles to kotlin exception class navigation item`() {
assertNavigationIcon(
diff --git a/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt
index ca287216..af10cbee 100644
--- a/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/DivergentSignatureTest.kt
@@ -1,8 +1,11 @@
package signatures
import org.junit.jupiter.api.Test
+import utils.OnlyDescriptors
+import utils.OnlyDescriptorsMPP
import utils.TestOutputWriterPlugin
+@OnlyDescriptorsMPP
class DivergentSignatureTest : AbstractRenderingTest() {
@Test
diff --git a/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt
index c9787b67..588b3d50 100644
--- a/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt
@@ -5,10 +5,7 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.jdk
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
-import utils.A
-import utils.Span
-import utils.TestOutputWriterPlugin
-import utils.match
+import utils.*
class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
private val configuration = dokkaConfiguration {
@@ -254,6 +251,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `java with java function`() {
val source = """
@@ -280,6 +278,7 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `java with kotlin function`() {
val source = """
diff --git a/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt
index 0767b2df..4cd9a94d 100644
--- a/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/InheritedAccessorsSignatureTest.kt
@@ -3,12 +3,10 @@ package signatures
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.junit.jupiter.api.Test
-import utils.A
-import utils.Span
-import utils.TestOutputWriterPlugin
-import utils.match
+import utils.*
import kotlin.test.assertEquals
+@JavaCode
class InheritedAccessorsSignatureTest : BaseAbstractTest() {
private val configuration = dokkaConfiguration {
@@ -24,6 +22,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("'var' expected but found: 'open var'")
@Test
fun `should collapse accessor functions inherited from java into the property`() {
val writerPlugin = TestOutputWriterPlugin()
@@ -76,6 +75,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("'var' expected but found: 'open var'")
@Test
fun `should render as val if inherited java property has no setter`() {
val writerPlugin = TestOutputWriterPlugin()
@@ -178,6 +178,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("'var' expected but found: 'open var'")
@Test
fun `should keep inherited java accessor lookalikes if underlying function is public`() {
val writerPlugin = TestOutputWriterPlugin()
@@ -228,6 +229,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `should keep kotlin property with no accessors when java inherits kotlin a var`() {
val writerPlugin = TestOutputWriterPlugin()
@@ -265,6 +267,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
}
}
+ @JavaCode
@Test
fun `kotlin property with compute get and set`() {
val writerPlugin = TestOutputWriterPlugin()
@@ -326,6 +329,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("'var' expected but found: 'open var'")
@Test
fun `inherited property should inherit getter's visibility`() {
val configWithProtectedVisibility = dokkaConfiguration {
@@ -399,6 +403,7 @@ class InheritedAccessorsSignatureTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("'var' expected but found: 'open var'")
@Test
fun `should resolve protected java property as protected`() {
val configWithProtectedVisibility = dokkaConfiguration {
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
index 38ae2be3..00d98102 100644
--- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
@@ -549,6 +549,7 @@ class SignatureTest : BaseAbstractTest() {
}
}
}
+ @OnlyDescriptorsMPP
@Test
fun `actual typealias should have generic parameters and fully qualified name of the expansion type`() {
val writerPlugin = TestOutputWriterPlugin()
@@ -583,6 +584,7 @@ class SignatureTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptorsMPP
@Test
fun `type with an actual typealias`() {
val writerPlugin = TestOutputWriterPlugin()
@@ -763,6 +765,7 @@ class SignatureTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("Order of constructors is different in K2")
@Test
fun `generic constructor params`() {
val writerPlugin = TestOutputWriterPlugin()
@@ -977,6 +980,7 @@ class SignatureTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("'var' expected but found: 'open var'")
@Test
fun `java property without accessors should be var`() {
val writerPlugin = TestOutputWriterPlugin()
diff --git a/plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt b/plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt
index a189894c..14c2752a 100644
--- a/plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt
+++ b/plugins/base/src/test/kotlin/superFields/DescriptorSuperPropertiesTest.kt
@@ -7,10 +7,12 @@ import org.jetbrains.dokka.model.InheritedMember
import org.jetbrains.dokka.model.IsVar
import org.jetbrains.dokka.model.KotlinVisibility
import org.junit.jupiter.api.Test
+import utils.JavaCode
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertNull
+@JavaCode
class DescriptorSuperPropertiesTest : BaseAbstractTest() {
private val commonTestConfiguration = dokkaConfiguration {
@@ -173,6 +175,7 @@ class DescriptorSuperPropertiesTest : BaseAbstractTest() {
}
}
+ // incorrect test https://github.com/Kotlin/dokka/issues/3128
@Test
fun `kotlin inheriting java should not append anything since field is public api`() {
val configuration = dokkaConfiguration {
diff --git a/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt b/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt
index 9c1265a6..5c7124cd 100644
--- a/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt
+++ b/plugins/base/src/test/kotlin/superFields/PsiSuperFieldsTest.kt
@@ -9,9 +9,11 @@ import org.jetbrains.dokka.model.isJvmField
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Assertions.assertNull
import org.junit.jupiter.api.Test
+import utils.JavaCode
import kotlin.test.assertEquals
+@JavaCode
class PsiSuperFieldsTest : BaseAbstractTest() {
private val commonTestConfiguration = dokkaConfiguration {
diff --git a/plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt b/plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt
index 9cde40a5..826df64e 100644
--- a/plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/InheritedEntriesDocumentableFilterTransfromerTest.kt
@@ -3,6 +3,7 @@ package transformers
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.model.DEnum
import org.junit.jupiter.api.Test
+import utils.OnlyDescriptors
import kotlin.test.assertEquals
import kotlin.test.assertTrue
@@ -133,6 +134,7 @@ class InheritedEntriesDocumentableFilterTransformerTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptors("Entry does not have `name` and `ordinal`") // TODO
@Test
fun `should work with enum entries when not suppressing`(){
testInline(
diff --git a/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt b/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt
index 39d725bb..e6cc393d 100644
--- a/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/MergeImplicitExpectActualDeclarationsTest.kt
@@ -9,6 +9,7 @@ import org.jetbrains.dokka.model.dfs
import org.jetbrains.dokka.model.firstChildOfType
import org.jetbrains.dokka.pages.*
import org.junit.jupiter.api.Test
+import utils.OnlyDescriptors
import utils.assertNotNull
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
@@ -269,6 +270,7 @@ class MergeImplicitExpectActualDeclarationsTest : BaseAbstractTest() {
fun PageNode.childrenRec(): List<PageNode> = listOf(this) + children.flatMap { it.childrenRec() }
+ @OnlyDescriptors("Enum entry [SMTH] does not have functions") // TODO
@Test
fun `should merge enum entries`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt b/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt
index 85db2d27..134e7f59 100644
--- a/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/ModuleAndPackageDocumentationTransformerFunctionalTest.kt
@@ -5,11 +5,13 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.io.TempDir
import transformers.AbstractContextModuleAndPackageDocumentationReaderTest.Companion.texts
+import utils.OnlyDescriptorsMPP
import java.nio.file.Path
import kotlin.test.assertEquals
class ModuleAndPackageDocumentationTransformerFunctionalTest : BaseAbstractTest() {
+ @OnlyDescriptorsMPP
@Test
fun `multiplatform project`(@TempDir tempDir: Path) {
val include = tempDir.resolve("include.md").toFile()
diff --git a/plugins/base/src/test/kotlin/transformers/ObviousAndInheritedFunctionsDocumentableFilterTest.kt b/plugins/base/src/test/kotlin/transformers/ObviousAndInheritedFunctionsDocumentableFilterTest.kt
index 3618c8fb..ffb5c9c8 100644
--- a/plugins/base/src/test/kotlin/transformers/ObviousAndInheritedFunctionsDocumentableFilterTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/ObviousAndInheritedFunctionsDocumentableFilterTest.kt
@@ -5,6 +5,7 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource
import testApi.testRunner.dokkaConfiguration
+import utils.JavaCode
import kotlin.test.assertEquals
class ObviousAndInheritedFunctionsDocumentableFilterTest : BaseAbstractTest() {
@@ -196,6 +197,7 @@ class ObviousAndInheritedFunctionsDocumentableFilterTest : BaseAbstractTest() {
@ParameterizedTest
@MethodSource(value = ["nonSuppressingObviousConfiguration", "nonSuppressingInheritedConfiguration"])
+ @JavaCode
fun `should not suppress toString, equals and hashcode if custom config is provided in Java`(nonSuppressingConfiguration: DokkaConfigurationImpl) {
testInline(
"""
diff --git a/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt b/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt
index 469c1a1e..532c9e81 100644
--- a/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/SourceLinkTransformerTest.kt
@@ -6,6 +6,7 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jsoup.nodes.Element
import org.junit.jupiter.api.Test
import signatures.renderedContent
+import utils.OnlyDescriptorsMPP
import utils.TestOutputWriterPlugin
import java.net.URL
import kotlin.test.assertEquals
@@ -66,6 +67,7 @@ class SourceLinkTransformerTest : BaseAbstractTest() {
}
}
+ @OnlyDescriptorsMPP
@Test
fun `source link should be for actual typealias`() {
val mppConfiguration = dokkaConfiguration {
diff --git a/plugins/base/src/test/kotlin/transformers/isExceptionTest.kt b/plugins/base/src/test/kotlin/transformers/isExceptionTest.kt
index ba00cf15..dd888ad6 100644
--- a/plugins/base/src/test/kotlin/transformers/isExceptionTest.kt
+++ b/plugins/base/src/test/kotlin/transformers/isExceptionTest.kt
@@ -5,8 +5,11 @@ import org.jetbrains.dokka.model.DClass
import org.jetbrains.dokka.model.DTypeAlias
import org.junit.jupiter.api.Test
import utils.AbstractModelTest
+import utils.JavaCode
+import utils.UsingJDK
class IsExceptionKotlinTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "classes") {
+ @UsingJDK
@Test
fun `isException should work for kotlin exception`(){
inlineModelTest(
@@ -20,6 +23,7 @@ class IsExceptionKotlinTest : AbstractModelTest("/src/main/kotlin/classes/Test.k
}
}
+ @UsingJDK
@Test
fun `isException should work for java exceptions`(){
inlineModelTest(
@@ -33,6 +37,7 @@ class IsExceptionKotlinTest : AbstractModelTest("/src/main/kotlin/classes/Test.k
}
}
+ @UsingJDK
@Test
fun `isException should work for RuntimeException`(){
inlineModelTest(
@@ -46,6 +51,7 @@ class IsExceptionKotlinTest : AbstractModelTest("/src/main/kotlin/classes/Test.k
}
}
+ @UsingJDK
@Test
fun `isException should work if exception is typealiased`(){
inlineModelTest(
@@ -59,6 +65,7 @@ class IsExceptionKotlinTest : AbstractModelTest("/src/main/kotlin/classes/Test.k
}
}
+ @UsingJDK
@Test
fun `isException should work if exception is extending a typaliased class`(){
inlineModelTest(
@@ -100,6 +107,7 @@ class IsExceptionKotlinTest : AbstractModelTest("/src/main/kotlin/classes/Test.k
}
}
+@JavaCode
class IsExceptionJavaTest: AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
@Test
fun `isException should work for java exceptions`(){
diff --git a/plugins/base/src/test/kotlin/translators/Bug1341.kt b/plugins/base/src/test/kotlin/translators/Bug1341.kt
index a8c9e342..3e1b403d 100644
--- a/plugins/base/src/test/kotlin/translators/Bug1341.kt
+++ b/plugins/base/src/test/kotlin/translators/Bug1341.kt
@@ -4,8 +4,10 @@ import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
import org.jetbrains.dokka.links.DRI
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
+import utils.JavaCode
class Bug1341 : BaseAbstractTest() {
+ @JavaCode
@Test
fun `reproduce bug #1341`() {
val configuration = dokkaConfiguration {
diff --git a/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt
index 57165fd1..4ae8f7ac 100644
--- a/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt
+++ b/plugins/base/src/test/kotlin/translators/DefaultDescriptorToDocumentableTranslatorTest.kt
@@ -10,6 +10,7 @@ import org.jetbrains.dokka.model.doc.*
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
+import utils.OnlyDescriptors
import utils.text
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
@@ -980,6 +981,7 @@ val soapXml = node("soap-env:Envelope", soapAttrs,
}
}
+ @OnlyDescriptors("Fix kdoc link") // TODO
@Test
fun `should have documentation for synthetic Enum valueOf functions`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt
index a763cbd2..b3f83d79 100644
--- a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt
+++ b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt
@@ -12,7 +12,9 @@ import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement
import org.jetbrains.dokka.DokkaConfiguration.Visibility
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test
+import utils.JavaCode
+@JavaCode
class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() {
val configuration = dokkaConfiguration {
sourceSets {
diff --git a/plugins/base/src/test/kotlin/translators/ExternalDocumentablesTest.kt b/plugins/base/src/test/kotlin/translators/ExternalDocumentablesTest.kt
index a9c865b4..c4087b20 100644
--- a/plugins/base/src/test/kotlin/translators/ExternalDocumentablesTest.kt
+++ b/plugins/base/src/test/kotlin/translators/ExternalDocumentablesTest.kt
@@ -10,8 +10,11 @@ import org.jetbrains.dokka.analysis.kotlin.internal.ExternalDocumentablesProvide
import org.jetbrains.dokka.analysis.kotlin.internal.InternalKotlinAnalysisPlugin
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
+import utils.OnlyDescriptors
+import utils.UsingJDK
class ExternalDocumentablesTest : BaseAbstractTest() {
+ @UsingJDK
@Test
fun `external documentable from java stdlib`() {
val configuration = dokkaConfiguration {
@@ -54,6 +57,10 @@ class ExternalDocumentablesTest : BaseAbstractTest() {
}
}
+
+ // typealias CompletionHandler = (cause: Throwable?) -> Unit
+ // FunctionalTypeConstructor(dri=kotlinx.coroutines/CompletionHandler///PointingToDeclaration/, projections=[], isExtensionFunction=false, isSuspendable=false, presentableName=null, extra=PropertyContainer(map={}))
+ @OnlyDescriptors(reason = "FunctionType has not parameters") // TODO
@Test
fun `external documentable from dependency`() {
val coroutinesPath =
diff --git a/plugins/base/src/test/kotlin/translators/JavadocInheritDocsTest.kt b/plugins/base/src/test/kotlin/translators/JavadocInheritDocsTest.kt
index 7fc6b7fa..a357491f 100644
--- a/plugins/base/src/test/kotlin/translators/JavadocInheritDocsTest.kt
+++ b/plugins/base/src/test/kotlin/translators/JavadocInheritDocsTest.kt
@@ -8,7 +8,9 @@ import org.jetbrains.dokka.model.doc.Text
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
+import utils.JavaCode
+@JavaCode
class JavadocInheritDocsTest : BaseAbstractTest() {
val configuration = dokkaConfiguration {
sourceSets {
@@ -211,6 +213,7 @@ class JavadocInheritDocsTest : BaseAbstractTest() {
}
+ @JavaCode
@Test
fun `work with multiple supertypes`() {
testInline(
diff --git a/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt b/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt
index ba0d95d5..1e3d784a 100644
--- a/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt
+++ b/plugins/base/src/test/kotlin/translators/JavadocInheritedDocTagsTest.kt
@@ -7,9 +7,11 @@ import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.model.doc.*
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
+import utils.JavaCode
import org.jetbrains.dokka.model.doc.Deprecated as DokkaDeprecatedTag
import org.jetbrains.dokka.model.doc.Throws as DokkaThrowsTag
+@JavaCode
class JavadocInheritedDocTagsTest : BaseAbstractTest() {
@Suppress("DEPRECATION") // for includeNonPublic
private val configuration = dokkaConfiguration {
diff --git a/plugins/base/src/test/kotlin/translators/JavadocParserTest.kt b/plugins/base/src/test/kotlin/translators/JavadocParserTest.kt
index 2c1173c0..8bc307df 100644
--- a/plugins/base/src/test/kotlin/translators/JavadocParserTest.kt
+++ b/plugins/base/src/test/kotlin/translators/JavadocParserTest.kt
@@ -9,8 +9,10 @@ import org.jetbrains.dokka.model.firstChildOfType
import org.jetbrains.dokka.model.firstMemberOfType
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
+import utils.JavaCode
import utils.text
+@JavaCode
class JavadocParserTest : BaseAbstractTest() {
private fun performJavadocTest(testOperation: (DModule) -> Unit) {
diff --git a/plugins/base/src/test/kotlin/utils/TagsAnnotations.kt b/plugins/base/src/test/kotlin/utils/TagsAnnotations.kt
new file mode 100644
index 00000000..181d1f1d
--- /dev/null
+++ b/plugins/base/src/test/kotlin/utils/TagsAnnotations.kt
@@ -0,0 +1,71 @@
+package utils
+
+import org.junit.jupiter.api.Tag
+
+
+/**
+ * Run a test only for descriptors, not symbols.
+ *
+ * In theory, these tests can be fixed
+ */
+@Target(
+ AnnotationTarget.CLASS,
+ AnnotationTarget.FUNCTION,
+ AnnotationTarget.PROPERTY_GETTER,
+ AnnotationTarget.PROPERTY_SETTER
+)
+@Retention(
+ AnnotationRetention.RUNTIME
+)
+@Tag("onlyDescriptors")
+annotation class OnlyDescriptors(val reason: String = "")
+
+/**
+ * Run a test only for descriptors, not symbols.
+ *
+ * These tests cannot be fixed until Analysis API does not support MPP
+ */
+@Target(
+ AnnotationTarget.CLASS,
+ AnnotationTarget.FUNCTION,
+ AnnotationTarget.PROPERTY_GETTER,
+ AnnotationTarget.PROPERTY_SETTER
+)
+@Retention(
+ AnnotationRetention.RUNTIME
+)
+@Tag("onlyDescriptorsMPP")
+annotation class OnlyDescriptorsMPP(val reason: String = "")
+
+
+/**
+ * For test containing .java code
+ * These tests are disabled in K2 due to Standlone prototype. https://github.com/Kotlin/dokka/issues/3114
+ */
+@Target(
+ AnnotationTarget.CLASS,
+ AnnotationTarget.FUNCTION,
+ AnnotationTarget.PROPERTY_GETTER,
+ AnnotationTarget.PROPERTY_SETTER
+)
+@Retention(
+ AnnotationRetention.RUNTIME
+)
+@Tag("javaCode")
+annotation class JavaCode
+
+/**
+ * For Kotlin test using JDK
+ * These tests are disabled in K2 due to Standlone prototype. https://github.com/Kotlin/dokka/issues/3114
+ */
+@Target(
+ AnnotationTarget.CLASS,
+ AnnotationTarget.FUNCTION,
+ AnnotationTarget.PROPERTY_GETTER,
+ AnnotationTarget.PROPERTY_SETTER
+)
+@Retention(
+ AnnotationRetention.RUNTIME
+)
+@Tag("usingJDK")
+annotation class UsingJDK \ No newline at end of file
diff --git a/plugins/mathjax/build.gradle.kts b/plugins/mathjax/build.gradle.kts
index 4c572450..1d10d838 100644
--- a/plugins/mathjax/build.gradle.kts
+++ b/plugins/mathjax/build.gradle.kts
@@ -3,6 +3,7 @@ import org.jetbrains.registerDokkaArtifactPublication
plugins {
id("org.jetbrains.conventions.kotlin-jvm")
id("org.jetbrains.conventions.maven-publish")
+ id("org.jetbrains.conventions.base-unit-test")
}
dependencies {
@@ -13,12 +14,17 @@ dependencies {
implementation(kotlin("reflect"))
testImplementation(libs.jsoup)
- testImplementation(projects.plugins.base.baseTestUtils)
testImplementation(projects.core.contentMatcherTestUtils)
testImplementation(kotlin("test-junit"))
testImplementation(projects.core.testApi)
testImplementation(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter)
+
+ symbolsTestConfiguration(project(path = ":subprojects:analysis-kotlin-symbols", configuration = "shadow"))
+ descriptorsTestConfiguration(project(path = ":subprojects:analysis-kotlin-descriptors", configuration = "shadow"))
+ testImplementation(projects.plugins.base.baseTestUtils) {
+ exclude(module = "analysis-kotlin-descriptors")
+ }
}
registerDokkaArtifactPublication("mathjaxPlugin") {