aboutsummaryrefslogtreecommitdiff
path: root/subprojects/analysis-kotlin-descriptors/compiler/src/main
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2023-07-21 15:19:17 +0300
committerGitHub <noreply@github.com>2023-07-21 15:19:17 +0300
commitf5393dd740eaf533fe9ff51003b175ef1c1418fe (patch)
tree1c81e3a76c338c6281abdb946ae835e1d8a15225 /subprojects/analysis-kotlin-descriptors/compiler/src/main
parent99062cbf5e332b3883c502da612d97f83eee9bff (diff)
downloaddokka-f5393dd740eaf533fe9ff51003b175ef1c1418fe.tar.gz
dokka-f5393dd740eaf533fe9ff51003b175ef1c1418fe.tar.bz2
dokka-f5393dd740eaf533fe9ff51003b175ef1c1418fe.zip
Update Kotlin to 1.9.0 (#3074)
* Update Kotlin Gradle Plugin to 1.9.0 * Update Android Gradle Plugin to 4.2.2 * Introduce convention plugin for Gradle runner https://github.com/gradle/gradle/issues/8301 * Fix unit test `common, jvm and macos source sets with kotlin multiplatform` * Update compiler to 1.9.0 * Update integration test * Add empty target for WASM integration test to avoid single target project See https://github.com/Kotlin/dokka/issues/3038 * Remove unused `plugins.shadow` from toml
Diffstat (limited to 'subprojects/analysis-kotlin-descriptors/compiler/src/main')
-rw-r--r--subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/AnalysisEnvironment.kt72
-rw-r--r--subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaJsResolverForModuleFactory.kt19
-rw-r--r--subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaNativeResolverForModuleFactory.kt19
-rw-r--r--subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/translator/DefaultDescriptorToDocumentableTranslator.kt6
4 files changed, 63 insertions, 53 deletions
diff --git a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/AnalysisEnvironment.kt b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/AnalysisEnvironment.kt
index ed9d887d..038a5ef7 100644
--- a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/AnalysisEnvironment.kt
+++ b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/AnalysisEnvironment.kt
@@ -343,23 +343,24 @@ class AnalysisEnvironment(
moduleInfo: ModuleInfo
): ResolverForModule =
CommonResolverForModuleFactory(
- CommonAnalysisParameters(
- metadataPartProviderFactory = { content ->
- environment.createPackagePartProvider(content.moduleContentScope)
- }
- ),
- CompilerEnvironment,
- unspecifiedJvmPlatform,
- true,
- dependencyContainer
- ).createResolverForModule(
+ CommonAnalysisParameters(
+ metadataPartProviderFactory = { content ->
+ environment.createPackagePartProvider(content.moduleContentScope)
+ }
+ ),
+ CompilerEnvironment,
+ unspecifiedJvmPlatform,
+ true,
+ dependencyContainer
+ ).createResolverForModule(
moduleDescriptor = descriptor as ModuleDescriptorImpl,
moduleContext = projectContext.withModule(descriptor),
moduleContent = modulesContent(moduleInfo),
resolverForProject = this,
languageVersionSettings = LanguageVersionSettingsImpl.DEFAULT,
sealedInheritorsProvider = CliSealedClassInheritorsProvider,
- resolveOptimizingOptions = null
+ resolveOptimizingOptions = null,
+ absentDescriptorHandlerClass = null
)
override fun sdkDependency(module: ModuleInfo): ModuleInfo? = null
@@ -387,7 +388,8 @@ class AnalysisEnvironment(
resolverForProject = this,
languageVersionSettings = LanguageVersionSettingsImpl.DEFAULT,
sealedInheritorsProvider = CliSealedClassInheritorsProvider,
- resolveOptimizingOptions = null
+ resolveOptimizingOptions = null,
+ absentDescriptorHandlerClass = null
)
override fun builtInsForModule(module: ModuleInfo): KotlinBuiltIns = DefaultBuiltIns.Instance
@@ -419,7 +421,8 @@ class AnalysisEnvironment(
resolverForProject = this,
languageVersionSettings = LanguageVersionSettingsImpl.DEFAULT,
sealedInheritorsProvider = CliSealedClassInheritorsProvider,
- resolveOptimizingOptions = null
+ resolveOptimizingOptions = null,
+ absentDescriptorHandlerClass = null
)
}
@@ -464,33 +467,34 @@ class AnalysisEnvironment(
descriptor: ModuleDescriptor,
moduleInfo: ModuleInfo
): ResolverForModule = JvmResolverForModuleFactory(
- JvmPlatformParameters(packagePartProviderFactory = { content ->
- JvmPackagePartProvider(
- configuration.languageVersionSettings,
- content.moduleContentScope
- )
- .apply {
- addRoots(javaRoots, messageCollector)
- }
- }, moduleByJavaClass = {
- val file =
- (it as? BinaryJavaClass)?.virtualFile ?: (it as JavaClassImpl).psi.containingFile.virtualFile
- if (file in sourcesScope)
- module
- else
- library
- }, resolverForReferencedModule = null,
- useBuiltinsProviderForModule = { false }),
- CompilerEnvironment,
- unspecifiedJvmPlatform
- ).createResolverForModule(
+ JvmPlatformParameters(packagePartProviderFactory = { content ->
+ JvmPackagePartProvider(
+ configuration.languageVersionSettings,
+ content.moduleContentScope
+ )
+ .apply {
+ addRoots(javaRoots, messageCollector)
+ }
+ }, moduleByJavaClass = {
+ val file =
+ (it as? BinaryJavaClass)?.virtualFile ?: (it as JavaClassImpl).psi.containingFile.virtualFile
+ if (file in sourcesScope)
+ module
+ else
+ library
+ }, resolverForReferencedModule = null,
+ useBuiltinsProviderForModule = { false }),
+ CompilerEnvironment,
+ unspecifiedJvmPlatform
+ ).createResolverForModule(
moduleDescriptor = descriptor as ModuleDescriptorImpl,
moduleContext = projectContext.withModule(descriptor),
moduleContent = modulesContent(moduleInfo),
resolverForProject = this,
languageVersionSettings = configuration.languageVersionSettings,
sealedInheritorsProvider = CliSealedClassInheritorsProvider,
- resolveOptimizingOptions = null
+ resolveOptimizingOptions = null,
+ absentDescriptorHandlerClass = null
)
override fun sdkDependency(module: ModuleInfo): ModuleInfo? = null
diff --git a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaJsResolverForModuleFactory.kt b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaJsResolverForModuleFactory.kt
index bb6148ad..c1965db2 100644
--- a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaJsResolverForModuleFactory.kt
+++ b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaJsResolverForModuleFactory.kt
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.serialization.js.DynamicTypeDeserializer
import org.jetbrains.kotlin.serialization.js.KotlinJavascriptSerializationUtil
import org.jetbrains.kotlin.serialization.js.createKotlinJavascriptPackageFragmentProvider
import org.jetbrains.kotlin.library.metadata.impl.KlibMetadataModuleDescriptorFactoryImpl
+import org.jetbrains.kotlin.resolve.lazy.AbsentDescriptorHandler
import org.jetbrains.kotlin.resolve.scopes.optimization.OptimizingOptions
import org.jetbrains.kotlin.utils.KotlinJavascriptMetadataUtils
import java.io.File
@@ -50,7 +51,8 @@ internal class DokkaJsResolverForModuleFactory(
resolverForProject: ResolverForProject<M>,
languageVersionSettings: LanguageVersionSettings,
sealedInheritorsProvider: SealedClassInheritorsProvider,
- resolveOptimizingOptions: OptimizingOptions?
+ resolveOptimizingOptions: OptimizingOptions?,
+ absentDescriptorHandlerClass: Class<out AbsentDescriptorHandler>?
): ResolverForModule {
val declarationProviderFactory = DeclarationProviderFactoryService.createDeclarationProviderFactory(
moduleContext.project,
@@ -61,13 +63,14 @@ internal class DokkaJsResolverForModuleFactory(
)
val container = createContainerForLazyResolve(
- moduleContext,
- declarationProviderFactory,
- CodeAnalyzerInitializer.getInstance(moduleContext.project).createTrace(), // BindingTraceContext(/* allowSliceRewrite = */ true),
- moduleDescriptor.platform!!,
- JsPlatformAnalyzerServices,
- targetEnvironment,
- languageVersionSettings
+ moduleContext = moduleContext,
+ declarationProviderFactory = declarationProviderFactory,
+ bindingTrace = CodeAnalyzerInitializer.getInstance(moduleContext.project).createTrace(), // BindingTraceContext(/* allowSliceRewrite = */ true),
+ platform = moduleDescriptor.platform!!,
+ analyzerServices = JsPlatformAnalyzerServices,
+ targetEnvironment = targetEnvironment,
+ languageVersionSettings = languageVersionSettings,
+ absentDescriptorHandlerClass = absentDescriptorHandlerClass
)
var packageFragmentProvider = container.get<ResolveSession>().packageFragmentProvider
diff --git a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaNativeResolverForModuleFactory.kt b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaNativeResolverForModuleFactory.kt
index ff1eb491..00b2bd68 100644
--- a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaNativeResolverForModuleFactory.kt
+++ b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/resolve/DokkaNativeResolverForModuleFactory.kt
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer
import org.jetbrains.kotlin.resolve.SealedClassInheritorsProvider
import org.jetbrains.kotlin.resolve.TargetEnvironment
import org.jetbrains.kotlin.resolve.konan.platform.NativePlatformAnalyzerServices
+import org.jetbrains.kotlin.resolve.lazy.AbsentDescriptorHandler
import org.jetbrains.kotlin.resolve.lazy.ResolveSession
import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactoryService
import org.jetbrains.kotlin.resolve.scopes.optimization.OptimizingOptions
@@ -36,7 +37,8 @@ internal class DokkaNativeResolverForModuleFactory(
resolverForProject: ResolverForProject<M>,
languageVersionSettings: LanguageVersionSettings,
sealedInheritorsProvider: SealedClassInheritorsProvider,
- resolveOptimizingOptions: OptimizingOptions?
+ resolveOptimizingOptions: OptimizingOptions?,
+ absentDescriptorHandlerClass: Class<out AbsentDescriptorHandler>?
): ResolverForModule {
val declarationProviderFactory = DeclarationProviderFactoryService.createDeclarationProviderFactory(
@@ -48,13 +50,14 @@ internal class DokkaNativeResolverForModuleFactory(
)
val container = createContainerForLazyResolve(
- moduleContext,
- declarationProviderFactory,
- CodeAnalyzerInitializer.getInstance(moduleContext.project).createTrace(),
- moduleDescriptor.platform!!,
- NativePlatformAnalyzerServices,
- targetEnvironment,
- languageVersionSettings
+ moduleContext = moduleContext,
+ declarationProviderFactory = declarationProviderFactory,
+ bindingTrace = CodeAnalyzerInitializer.getInstance(moduleContext.project).createTrace(),
+ platform = moduleDescriptor.platform!!,
+ analyzerServices = NativePlatformAnalyzerServices,
+ targetEnvironment = targetEnvironment,
+ languageVersionSettings = languageVersionSettings,
+ absentDescriptorHandlerClass = absentDescriptorHandlerClass
)
var packageFragmentProvider = container.get<ResolveSession>().packageFragmentProvider
diff --git a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/translator/DefaultDescriptorToDocumentableTranslator.kt b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/translator/DefaultDescriptorToDocumentableTranslator.kt
index cb52236e..08313503 100644
--- a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/translator/DefaultDescriptorToDocumentableTranslator.kt
+++ b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/translator/DefaultDescriptorToDocumentableTranslator.kt
@@ -1149,14 +1149,14 @@ private class DokkaDescriptorVisitor(
fullEnumEntryName(),
DRI(enumClassId.packageFqName.asString(), fullEnumEntryName())
)
- is ConstantsKtClassValue -> when (value) {
- is NormalClass -> (value as NormalClass).value.classId.let {
+ is ConstantsKtClassValue -> when (val value = value) {
+ is NormalClass -> value.classId.let {
ClassValue(
it.relativeClassName.asString(),
DRI(it.packageFqName.asString(), it.relativeClassName.asString())
)
}
- is LocalClass -> (value as LocalClass).type.let {
+ is LocalClass -> value.type.let {
ClassValue(
it.toString(),
DRI.from(it.constructor.declarationDescriptor as DeclarationDescriptor)