[Platform API] Make 'ModuleInfo.platform' non-nullable

This commit is contained in:
Dmitry Savvinov
2019-03-26 18:00:30 +03:00
parent 2d528c6396
commit 1606b3bf23
9 changed files with 46 additions and 29 deletions
@@ -38,6 +38,7 @@ import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.load.kotlin.MetadataFinderFactory
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.CommonPlatforms
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.*
@@ -67,6 +68,9 @@ object CommonResolverForModuleFactory : ResolverForModuleFactory() {
override fun dependencyOnBuiltIns(): ModuleInfo.DependencyOnBuiltIns =
if (dependOnOldBuiltIns) ModuleInfo.DependencyOnBuiltIns.LAST else ModuleInfo.DependencyOnBuiltIns.NONE
override val platform: TargetPlatform
get() = CommonPlatforms.defaultCommonPlatform
override val compilerServices: PlatformDependentCompilerServices
get() = CommonPlatformCompilerServices
}
@@ -147,7 +147,7 @@ abstract class AbstractFirDiagnosticsSmokeTest : BaseDiagnosticsTest() {
}
class BuiltInModuleInfo(override val name: Name) : ModuleInfo {
override val platform: TargetPlatform?
override val platform: TargetPlatform
get() = JvmPlatforms.defaultJvmPlatform
override val compilerServices: PlatformDependentCompilerServices
@@ -159,7 +159,7 @@ abstract class AbstractFirDiagnosticsSmokeTest : BaseDiagnosticsTest() {
}
protected class TestModuleInfo(override val name: Name) : ModuleInfo {
override val platform: TargetPlatform?
override val platform: TargetPlatform
get() = JvmPlatforms.defaultJvmPlatform
override val compilerServices: PlatformDependentCompilerServices
@@ -16,8 +16,8 @@ interface ModuleInfo {
val displayedName: String get() = name.asString()
fun dependencies(): List<ModuleInfo>
val expectedBy: List<ModuleInfo> get() = emptyList()
val platform: TargetPlatform? get() = null
val compilerServices: PlatformDependentCompilerServices? get() = null
val platform: TargetPlatform
val compilerServices: PlatformDependentCompilerServices
fun modulesWhoseInternalsAreVisible(): Collection<ModuleInfo> = listOf()
val capabilities: Map<ModuleDescriptor.Capability<*>, Any?>
get() = mapOf(Capability to this)
@@ -193,7 +193,7 @@ class ResolverForProjectImpl<M : ModuleInfo>(
descriptor as ModuleDescriptorImpl,
projectContext.withModule(descriptor),
moduleContent,
platformParameters(module.platform ?: TODO("Missing platform!")),
platformParameters(module.platform),
targetEnvironment,
this@ResolverForProjectImpl,
languageVersionSettings
@@ -69,6 +69,6 @@ private class TestModule(val dependsOnBuiltIns: Boolean) : ModuleInfo {
override val platform: TargetPlatform
get() = JvmPlatforms.defaultJvmPlatform
override val compilerServices: PlatformDependentCompilerServices?
override val compilerServices: PlatformDependentCompilerServices
get() = JvmPlatformCompilerServices
}
@@ -64,7 +64,7 @@ class MultiModuleJavaAnalysisCustomTest : KtUsefulTestCase() {
override val platform: TargetPlatform
get() = JvmPlatforms.defaultJvmPlatform
override val compilerServices: PlatformDependentCompilerServices?
override val compilerServices: PlatformDependentCompilerServices
get() = JvmPlatformCompilerServices
}