diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/MetadataSerializer.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/MetadataSerializer.kt index 81e29e33ed3..927756f17bb 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/MetadataSerializer.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/MetadataSerializer.kt @@ -16,7 +16,7 @@ package org.jetbrains.kotlin.cli.metadata -import org.jetbrains.kotlin.analyzer.common.DefaultAnalyzerFacade +import org.jetbrains.kotlin.analyzer.common.CommonAnalyzerFacade import org.jetbrains.kotlin.builtins.BuiltInsBinaryVersion import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport @@ -64,7 +64,7 @@ open class MetadataSerializer(private val dependOnOldBuiltIns: Boolean) { val analyzer = AnalyzerWithCompilerReport(messageCollector) analyzer.analyzeAndReport(files) { - DefaultAnalyzerFacade.analyzeFiles(files, moduleName, dependOnOldBuiltIns, configuration.languageVersionSettings) { _, content -> + CommonAnalyzerFacade.analyzeFiles(files, moduleName, dependOnOldBuiltIns, configuration.languageVersionSettings) { _, content -> environment.createPackagePartProvider(content.moduleContentScope) } } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatform.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatform.kt index d2394a10703..a68b89daecb 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatform.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/platform/JvmPlatform.kt @@ -26,7 +26,7 @@ import java.util.* object JvmPlatform : TargetPlatform("JVM") { private val defaultImports = LockBasedStorageManager().createMemoizedFunction> { includeKotlinComparisons -> ArrayList().apply { - addAll(Default.getDefaultImports(includeKotlinComparisons)) + addAll(Common.getDefaultImports(includeKotlinComparisons)) add(ImportPath.fromString("java.lang.*")) add(ImportPath.fromString("kotlin.jvm.*")) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalyzerFacade.kt b/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalyzerFacade.kt index f82f3bb8d22..c3c58e723a9 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalyzerFacade.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/analyzer/AnalyzerFacade.kt @@ -234,7 +234,7 @@ interface ModuleInfo { // but if they are present, they should come after JVM built-ins in the dependencies list, because JVM built-ins contain // additional members dependent on the JDK fun dependencyOnBuiltIns(): ModuleInfo.DependencyOnBuiltIns = - if (platform == TargetPlatform.Default) + if (platform == TargetPlatform.Common) ModuleInfo.DependencyOnBuiltIns.AFTER_SDK else ModuleInfo.DependencyOnBuiltIns.LAST diff --git a/compiler/frontend/src/org/jetbrains/kotlin/analyzer/common/DefaultAnalyzerFacade.kt b/compiler/frontend/src/org/jetbrains/kotlin/analyzer/common/CommonAnalyzerFacade.kt similarity index 97% rename from compiler/frontend/src/org/jetbrains/kotlin/analyzer/common/DefaultAnalyzerFacade.kt rename to compiler/frontend/src/org/jetbrains/kotlin/analyzer/common/CommonAnalyzerFacade.kt index 9a722d8178d..dfbfb950ca3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/analyzer/common/DefaultAnalyzerFacade.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/analyzer/common/CommonAnalyzerFacade.kt @@ -46,9 +46,9 @@ import org.jetbrains.kotlin.serialization.deserialization.MetadataPackageFragmen /** * A facade that is used to analyze common (platform-independent) modules in multi-platform projects. - * See [TargetPlatform.Default] + * See [TargetPlatform.Common] */ -object DefaultAnalyzerFacade : AnalyzerFacade() { +object CommonAnalyzerFacade : AnalyzerFacade() { private class SourceModuleInfo( override val name: Name, override val capabilities: Map, Any?>, @@ -77,7 +77,7 @@ object DefaultAnalyzerFacade : AnalyzerFacade() { @Suppress("NAME_SHADOWING") val resolver = ResolverForProjectImpl ( "sources for metadata serializer", - ProjectContext(project), listOf(moduleInfo), { DefaultAnalyzerFacade }, + ProjectContext(project), listOf(moduleInfo), { CommonAnalyzerFacade }, { ModuleContent(files, GlobalSearchScope.allScope(project)) }, object : PlatformAnalysisParameters {}, languageSettingsProvider = object : LanguageSettingsProvider { @@ -159,5 +159,5 @@ object DefaultAnalyzerFacade : AnalyzerFacade() { } override val targetPlatform: TargetPlatform - get() = TargetPlatform.Default + get() = TargetPlatform.Common } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/frontend/di/injection.kt b/compiler/frontend/src/org/jetbrains/kotlin/frontend/di/injection.kt index fb7700e4ca2..e987c467531 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/frontend/di/injection.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/frontend/di/injection.kt @@ -170,7 +170,7 @@ fun createLazyResolveSession(moduleContext: ModuleContext, files: Collection> { includeKotlinComparisons -> ArrayList().apply { diff --git a/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt b/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt index 2b279c7679a..d40212b5d77 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt +++ b/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt @@ -20,7 +20,7 @@ import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.util.text.StringUtil import com.intellij.psi.search.GlobalSearchScope import org.jetbrains.kotlin.analyzer.AnalysisResult -import org.jetbrains.kotlin.analyzer.common.DefaultAnalyzerFacade +import org.jetbrains.kotlin.analyzer.common.CommonAnalyzerFacade import org.jetbrains.kotlin.cli.jvm.compiler.CliLightClassGenerationSupport import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM import org.jetbrains.kotlin.config.* @@ -293,7 +293,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { val platform = moduleDescriptor.getMultiTargetPlatform() if (platform == MultiTargetPlatform.Common) { - return DefaultAnalyzerFacade.analyzeFiles( + return CommonAnalyzerFacade.analyzeFiles( files, moduleDescriptor.name, true, languageVersionSettings, mapOf( MultiTargetPlatform.CAPABILITY to MultiTargetPlatform.Common, diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/IdePlatformSupport.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/IdePlatformSupport.kt index 8530181f265..13d028bccc1 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/IdePlatformSupport.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/IdePlatformSupport.kt @@ -21,7 +21,7 @@ import com.intellij.openapi.extensions.Extensions import com.intellij.openapi.module.Module import com.intellij.openapi.roots.libraries.PersistentLibraryKind import org.jetbrains.kotlin.analyzer.AnalyzerFacade -import org.jetbrains.kotlin.analyzer.common.DefaultAnalyzerFacade +import org.jetbrains.kotlin.analyzer.common.CommonAnalyzerFacade import org.jetbrains.kotlin.builtins.DefaultBuiltIns import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider @@ -107,10 +107,10 @@ class JsPlatformSupport : IdePlatformSupport() { class CommonPlatformSupport : IdePlatformSupport() { override val platform: TargetPlatform - get() = TargetPlatform.Default + get() = TargetPlatform.Common override val analyzerFacade: AnalyzerFacade - get() = DefaultAnalyzerFacade + get() = CommonAnalyzerFacade override val libraryKind: PersistentLibraryKind<*>? get() = CommonLibraryKind diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/LibraryDependenciesCache.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/LibraryDependenciesCache.kt index 890e279dbec..7c8cdc8fe3f 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/LibraryDependenciesCache.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/LibraryDependenciesCache.kt @@ -102,7 +102,7 @@ class LibraryDependenciesCacheImpl(private val project: Project) : LibraryDepend * @return true if it's OK to add a dependency from a library with platform [from] to a library with platform [to] */ private fun compatiblePlatforms(from: TargetPlatform, to: TargetPlatform): Boolean { - return from == to || to == TargetPlatform.Default + return from == to || to == TargetPlatform.Common } private fun getLibraryUsageIndex(): LibraryUsageIndex { diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt index c6dca3275db..4b7755fe049 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt @@ -32,7 +32,7 @@ import org.jetbrains.kotlin.serialization.deserialization.MetadataPackageFragmen import java.io.ByteArrayInputStream class KotlinBuiltInDecompiler : KotlinMetadataDecompiler( - KotlinBuiltInFileType, TargetPlatform.Default, BuiltInSerializerProtocol, + KotlinBuiltInFileType, TargetPlatform.Common, BuiltInSerializerProtocol, FlexibleTypeDeserializer.ThrowException, BuiltInsBinaryVersion.INSTANCE, BuiltInsBinaryVersion.INVALID_VERSION, KotlinStubVersions.BUILTIN_STUB_VERSION ) { diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/framework/LibraryKinds.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/framework/LibraryKinds.kt index f05ef58dfec..60e0d81a30b 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/framework/LibraryKinds.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/framework/LibraryKinds.kt @@ -59,7 +59,7 @@ fun getLibraryPlatform(library: Library): TargetPlatform { return when (library.kind) { JSLibraryKind -> JsPlatform - CommonLibraryKind -> TargetPlatform.Default + CommonLibraryKind -> TargetPlatform.Common else -> JvmPlatform } } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/PlatformHeaderAnnotator.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/PlatformHeaderAnnotator.kt index 2c1891f7633..736d46a4785 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/PlatformHeaderAnnotator.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/PlatformHeaderAnnotator.kt @@ -58,7 +58,7 @@ class PlatformHeaderAnnotator : Annotator { val declaration = element as? KtDeclaration ?: return if (!isHeaderDeclaration(declaration)) return - if (TargetPlatformDetector.getPlatform(declaration.containingKtFile) !is TargetPlatform.Default) return + if (TargetPlatformDetector.getPlatform(declaration.containingKtFile) !is TargetPlatform.Common) return val implementingModules = declaration.findModuleDescriptor().allImplementingCompatibleModules if (implementingModules.isEmpty()) return diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/generate/KotlinGenerateEqualsAndHashcodeAction.kt b/idea/src/org/jetbrains/kotlin/idea/actions/generate/KotlinGenerateEqualsAndHashcodeAction.kt index de350334e0a..4f7e814232e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/generate/KotlinGenerateEqualsAndHashcodeAction.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/generate/KotlinGenerateEqualsAndHashcodeAction.kt @@ -144,7 +144,7 @@ class KotlinGenerateEqualsAndHashcodeAction : KotlinGenerateMemberActionBase "other == null || this::class.js != $paramName::class.js" - is TargetPlatform.Default -> "other == null || this::class != $paramName::class" + is TargetPlatform.Common -> "other == null || this::class != $paramName::class" else -> defaultExpression } } @@ -154,7 +154,7 @@ class KotlinGenerateEqualsAndHashcodeAction : KotlinGenerateMemberActionBase "this::class.js" - is TargetPlatform.Default -> "this::class" + is TargetPlatform.Common -> "this::class" else -> defaultExpression } } diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/generate/AbstractCodeInsightActionTest.kt b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/generate/AbstractCodeInsightActionTest.kt index f36b96bb90c..769b8a5518f 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/generate/AbstractCodeInsightActionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/generate/AbstractCodeInsightActionTest.kt @@ -91,7 +91,7 @@ abstract class AbstractCodeInsightActionTest : KotlinLightCodeInsightFixtureTest val targetPlatform = when (targetPlatformName) { "JVM" -> JvmPlatform "JavaScript" -> JsPlatform - "Common" -> TargetPlatform.Default + "Common" -> TargetPlatform.Common else -> error("Unexpected platform name: $targetPlatformName") } mainPsiFile.targetPlatform = targetPlatform diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/JsPlatform.kt b/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/JsPlatform.kt index 7a13985b8dc..ff53279a4a6 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/JsPlatform.kt +++ b/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/JsPlatform.kt @@ -27,7 +27,7 @@ import org.jetbrains.kotlin.storage.LockBasedStorageManager object JsPlatform : TargetPlatform("JS") { private val defaultImports = LockBasedStorageManager().createMemoizedFunction> { includeKotlinComparisons -> - Default.getDefaultImports(includeKotlinComparisons) + ImportPath.fromString("kotlin.js.*") + Common.getDefaultImports(includeKotlinComparisons) + ImportPath.fromString("kotlin.js.*") } override fun getDefaultImports(includeKotlinComparisons: Boolean): List = defaultImports(includeKotlinComparisons)