aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt9
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt12
2 files changed, 10 insertions, 11 deletions
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt
index ea8ce2f6..9726e5b7 100644
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt
+++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt
@@ -17,12 +17,11 @@ internal fun createEnvironmentAndFacade(
if (analysisPlatform == Platform.jvm) {
addClasspath(PathUtil.getJdkClassesRootsFromCurrentJre())
}
- sourceSet.classpath.forEach(::addClasspath)
- addSources(
- (sourceSet.sourceRoots + sourceSets.filter { it.sourceSetID in sourceSet.dependentSourceSets }
- .flatMap { it.sourceRoots })
- )
+ val parentSourceSets = sourceSets.filter { it.sourceSetID in sourceSet.dependentSourceSets }
+ addClasspath(sourceSet.classpath + parentSourceSets.flatMap { it.classpath })
+
+ addSources(sourceSet.sourceRoots + parentSourceSets.flatMap { it.sourceRoots })
loadLanguageVersionSettings(sourceSet.languageVersion, sourceSet.apiVersion)
diff --git a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt
index 8b21e44d..6ccc9ecc 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/converters/KotlinToJavaConverter.kt
@@ -198,7 +198,7 @@ internal fun DClasslike.asJava(): DClasslike = when (this) {
}
internal fun DClass.asJava(): DClass = copy(
- constructors = constructors.map { it.asJava(name) },
+ constructors = constructors.map { it.asJava(dri.classNames ?: name) }, // name may not always be valid here, however classNames should always be not null
functions = functionsInJava(),
properties = properties.map { it.asJava() },
classlikes = classlikes.map { it.asJava() },
@@ -212,7 +212,7 @@ internal fun DClass.asJava(): DClass = copy(
internal fun DClass.functionsInJava(): List<DFunction> =
(properties.filter { it.jvmField() == null }
.flatMap { property -> listOfNotNull(property.getter, property.setter) } + functions).map {
- it.asJava(name)
+ it.asJava(dri.classNames ?: name)
}
private fun DTypeParameter.asJava(): DTypeParameter = copy(
@@ -251,9 +251,9 @@ private fun Bound.asJava(): Bound = when (this) {
}
internal fun DEnum.asJava(): DEnum = copy(
- constructors = constructors.map { it.asJava(name) },
+ constructors = constructors.map { it.asJava(dri.classNames ?: name) },
functions = (functions + properties.map { it.getter } + properties.map { it.setter }).filterNotNull().map {
- it.asJava(name)
+ it.asJava(dri.classNames ?: name)
},
properties = properties.map { it.asJava() },
classlikes = classlikes.map { it.asJava() },
@@ -264,7 +264,7 @@ internal fun DEnum.asJava(): DEnum = copy(
internal fun DObject.asJava(): DObject = copy(
functions = (functions + properties.map { it.getter } + properties.map { it.setter })
.filterNotNull()
- .map { it.asJava(name.orEmpty()) },
+ .map { it.asJava(dri.classNames ?: name.orEmpty()) },
properties = properties.map { it.asJava() } +
DProperty(
name = "INSTANCE",
@@ -294,7 +294,7 @@ internal fun DObject.asJava(): DObject = copy(
internal fun DInterface.asJava(): DInterface = copy(
functions = (functions + properties.map { it.getter } + properties.map { it.setter })
.filterNotNull()
- .map { it.asJava(name) },
+ .map { it.asJava(dri.classNames ?: name) },
properties = emptyList(),
classlikes = classlikes.map { it.asJava() }, // TODO: public static final class DefaultImpls with impls for methods
generics = generics.map { it.asJava() },