diff options
-rw-r--r-- | kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt | 2 | ||||
-rw-r--r-- | plugins/base/src/test/kotlin/filter/JavaFileFilterTest.kt | 37 |
2 files changed, 38 insertions, 1 deletions
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt index 9efa66fb..37381b0f 100644 --- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt +++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt @@ -571,7 +571,7 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl fun addSources(sourceDirectories: Iterable<File>) { sourceDirectories.forEach { directory -> configuration.addKotlinSourceRoot(directory.path) - if (directory.isDirectory || directory.extension == ".java") { + if (directory.isDirectory || directory.extension == "java") { configuration.addJavaSourceRoot(directory) } } diff --git a/plugins/base/src/test/kotlin/filter/JavaFileFilterTest.kt b/plugins/base/src/test/kotlin/filter/JavaFileFilterTest.kt new file mode 100644 index 00000000..f618292c --- /dev/null +++ b/plugins/base/src/test/kotlin/filter/JavaFileFilterTest.kt @@ -0,0 +1,37 @@ +package filter + +import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.Test +import kotlin.test.assertEquals + +class JavaFileFilterTest : BaseAbstractTest() { + @Test + fun `java file should be included`() { + val configuration = dokkaConfiguration { + sourceSets { + sourceSet { + skipEmptyPackages = false + sourceRoots = listOf("src/main/java/basic/Test.java") + } + } + } + + testInline( + """ + |/src/main/java/basic/Test.java + |package example; + | + | + | + """.trimMargin(), + configuration + ) { + preMergeDocumentablesTransformationStage = { + Assertions.assertTrue( + it.first().packages.isNotEmpty() + ) + } + } + } +} |