diff options
Diffstat (limited to 'subprojects')
5 files changed, 68 insertions, 53 deletions
diff --git a/subprojects/analysis-kotlin-descriptors/build.gradle.kts b/subprojects/analysis-kotlin-descriptors/build.gradle.kts index 3f028090..452bf7c6 100644 --- a/subprojects/analysis-kotlin-descriptors/build.gradle.kts +++ b/subprojects/analysis-kotlin-descriptors/build.gradle.kts @@ -8,6 +8,11 @@ plugins { } dependencies { + // to override some interfaces (JvmAnnotationEnumFieldValue, JvmAnnotationConstantValue) from compiler since thet are empty there + // should be `api` since we already have it in :analysis-java-psi + api(libs.intellij.java.psi.api) { + isTransitive = false + } implementation(projects.subprojects.analysisKotlinApi) implementation(projects.subprojects.analysisKotlinDescriptors.compiler) implementation(projects.subprojects.analysisKotlinDescriptors.ide) 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) |