Introduce unspecifiedJvmPlatform for clients without jvmTarget
Previously, a lot of clients used JvmPlatform as platform-marker, without thinking about jvmTarget. For the sake of migration, this commits introduced so-called UnspecifiedJvmPlatform, which can be used for a time being, but generally, all usages should be removed in future.
This commit is contained in:
@@ -8,8 +8,7 @@ package org.jetbrains.kotlin.platform
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms.defaultJsPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms.defaultJvmPlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms.jvm18
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms.unspecifiedJvmPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatforms.defaultKonanPlatform
|
||||
|
||||
@@ -17,12 +16,12 @@ import org.jetbrains.kotlin.platform.konan.KonanPlatforms.defaultKonanPlatform
|
||||
object CommonPlatforms {
|
||||
|
||||
@Deprecated(
|
||||
message = "Should be accessed only by compatibility layer, other clients should use 'defaultJvmPlatform'",
|
||||
message = "Should be accessed only by compatibility layer, other clients should use 'unspecifiedJvmPlatform'",
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
object CompatCommonPlatform : TargetPlatform(
|
||||
setOf(
|
||||
defaultJvmPlatform.single(),
|
||||
unspecifiedJvmPlatform.single(),
|
||||
defaultJsPlatform.single(),
|
||||
defaultKonanPlatform.single()
|
||||
)
|
||||
|
||||
+3
-3
@@ -138,7 +138,7 @@ abstract class AbstractFirDiagnosticsSmokeTest : BaseDiagnosticsTest() {
|
||||
when {
|
||||
nameSuffix.isEmpty() -> null // TODO(dsavvinov): this leads to 'null'-platform in ModuleDescriptor
|
||||
nameSuffix == "COMMON" -> CommonPlatforms.defaultCommonPlatform
|
||||
nameSuffix == "JVM" -> JvmPlatforms.defaultJvmPlatform // TODO(dsavvinov): determine JvmTarget precisely
|
||||
nameSuffix == "JVM" -> JvmPlatforms.unspecifiedJvmPlatform // TODO(dsavvinov): determine JvmTarget precisely
|
||||
nameSuffix == "JS" -> JsPlatforms.defaultJsPlatform
|
||||
nameSuffix == "NATIVE" -> KonanPlatforms.defaultKonanPlatform
|
||||
else -> throw IllegalStateException("Can't determine platform by name $nameSuffix")
|
||||
@@ -148,7 +148,7 @@ abstract class AbstractFirDiagnosticsSmokeTest : BaseDiagnosticsTest() {
|
||||
|
||||
class BuiltInModuleInfo(override val name: Name) : ModuleInfo {
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
@@ -160,7 +160,7 @@ abstract class AbstractFirDiagnosticsSmokeTest : BaseDiagnosticsTest() {
|
||||
|
||||
protected class TestModuleInfo(override val name: Name) : ModuleInfo {
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
|
||||
@@ -22,8 +22,13 @@ object JvmPlatforms {
|
||||
private val jvmTargetToJdkPlatform: Map<JvmTarget, TargetPlatform> =
|
||||
JvmTarget.values().map { it to JdkPlatform(it).toTargetPlatform() }.toMap()
|
||||
|
||||
val defaultJvmPlatform: TargetPlatform
|
||||
get() = CompatJvmPlatform
|
||||
// This platform is needed mostly for compatibility and migration of code base,
|
||||
// as previously some clients used TargetPlatform just as platform-marker
|
||||
// and didn't care about particular jvmTarget.
|
||||
// TODO(dsavvinov): review all usages and choose proper JvmTarget
|
||||
val unspecifiedJvmPlatform: TargetPlatform = CompatJvmPlatform
|
||||
|
||||
val defaultJvmPlatform: TargetPlatform = jvmTargetToJdkPlatform[JvmTarget.DEFAULT]!!
|
||||
|
||||
val jvm16: TargetPlatform = jvmTargetToJdkPlatform[JvmTarget.JVM_1_6]!!
|
||||
val jvm18: TargetPlatform = jvmTargetToJdkPlatform[JvmTarget.JVM_1_8]!!
|
||||
@@ -34,7 +39,7 @@ object JvmPlatforms {
|
||||
val allJvmPlatforms: List<TargetPlatform> = jvmTargetToJdkPlatform.values.toList()
|
||||
|
||||
@Deprecated(
|
||||
message = "Should be accessed only by compatibility layer, other clients should use 'defaultJvmPlatform'",
|
||||
message = "Should be accessed only by compatibility layer, other clients should use 'unspecifiedJvmPlatform'",
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
object CompatJvmPlatform : TargetPlatform(setOf(UNSPECIFIED_SIMPLE_JVM_PLATFORM)),
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||
|
||||
@Deprecated(
|
||||
message = "This class is deprecated and will be removed soon, use API from 'org.jetbrains.kotlin.platform.*' packages instead",
|
||||
replaceWith = ReplaceWith("JvmPlatforms.defaultJvmPlatform", "org.jetbrains.kotlin.platform.jvm.JvmPlatforms"),
|
||||
replaceWith = ReplaceWith("JvmPlatforms.unspecifiedJvmPlatform", "org.jetbrains.kotlin.platform.jvm.JvmPlatforms"),
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
interface JvmPlatform : TargetPlatform {
|
||||
|
||||
+1
-1
@@ -594,7 +594,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() {
|
||||
when {
|
||||
nameSuffix.isEmpty() -> null // TODO(dsavvinov): this leads to 'null'-platform in ModuleDescriptor
|
||||
nameSuffix == "COMMON" -> CommonPlatforms.defaultCommonPlatform
|
||||
nameSuffix == "JVM" -> JvmPlatforms.defaultJvmPlatform // TODO(dsavvinov): determine JvmTarget precisely
|
||||
nameSuffix == "JVM" -> JvmPlatforms.unspecifiedJvmPlatform // TODO(dsavvinov): determine JvmTarget precisely
|
||||
nameSuffix == "JS" -> JsPlatforms.defaultJsPlatform
|
||||
nameSuffix == "NATIVE" -> KonanPlatforms.defaultKonanPlatform
|
||||
else -> throw IllegalStateException("Can't determine platform by name $nameSuffix")
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
|
||||
class FirTestModuleInfo(
|
||||
override val name: Name = Name.identifier("TestModule"),
|
||||
val dependencies: MutableList<ModuleInfo> = mutableListOf(),
|
||||
override val platform: TargetPlatform = JvmPlatforms.defaultJvmPlatform,
|
||||
override val platform: TargetPlatform = JvmPlatforms.unspecifiedJvmPlatform,
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices = JvmPlatformAnalyzerServices
|
||||
) : ModuleInfo {
|
||||
override fun dependencies(): List<ModuleInfo> = dependencies
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ private class TestModule(val dependsOnBuiltIns: Boolean) : ModuleInfo {
|
||||
ModuleInfo.DependencyOnBuiltIns.NONE
|
||||
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ class MultiModuleJavaAnalysisCustomTest : KtUsefulTestCase() {
|
||||
override val name = Name.special("<$_name>")
|
||||
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
|
||||
@@ -362,7 +362,7 @@ data class SdkInfo(val project: Project, val sdk: Sdk) : IdeaModuleInfo {
|
||||
override fun dependencies(): List<IdeaModuleInfo> = listOf(this)
|
||||
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform // TODO(dsavvinov): provide proper target version
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform // TODO(dsavvinov): provide proper target version
|
||||
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
|
||||
+3
-3
@@ -51,7 +51,7 @@ data class ScriptModuleInfo(
|
||||
}
|
||||
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform // TODO(dsavvinov): choose proper target version
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform // TODO(dsavvinov): choose proper target version
|
||||
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
@@ -77,7 +77,7 @@ sealed class ScriptDependenciesInfo(val project: Project) : IdeaModuleInfo, Bina
|
||||
get() = ScriptDependenciesSourceInfo.ForProject(project)
|
||||
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform // TODO(dsavvinov): choose proper TargetVersion
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform // TODO(dsavvinov): choose proper TargetVersion
|
||||
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
@@ -132,7 +132,7 @@ sealed class ScriptDependenciesSourceInfo(val project: Project) : IdeaModuleInfo
|
||||
override fun equals(other: Any?): Boolean = other is ScriptDependenciesSourceInfo && this.project == other.project
|
||||
|
||||
override val platform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform // TODO(dsavvinov): choose proper TargetVersion
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform // TODO(dsavvinov): choose proper TargetVersion
|
||||
|
||||
override val analyzerServices: PlatformDependentAnalyzerServices
|
||||
get() = JvmPlatformAnalyzerServices
|
||||
|
||||
+1
-1
@@ -332,5 +332,5 @@ class IDEKotlinAsJavaSupport(private val project: Project) : KotlinAsJavaSupport
|
||||
}
|
||||
|
||||
internal fun PsiElement.getModuleInfoPreferringJvmPlatform(): IdeaModuleInfo {
|
||||
return getPlatformModuleInfo(JvmPlatforms.defaultJvmPlatform) ?: getModuleInfo()
|
||||
return getPlatformModuleInfo(JvmPlatforms.unspecifiedJvmPlatform) ?: getModuleInfo()
|
||||
}
|
||||
+1
-1
@@ -126,7 +126,7 @@ internal class ProjectResolutionFacade(
|
||||
packagePartProviderFactory = { IDEPackagePartProvider(it.moduleContentScope) },
|
||||
moduleByJavaClass = { javaClass: JavaClass ->
|
||||
val psiClass = (javaClass as JavaClassImpl).psi
|
||||
psiClass.getPlatformModuleInfo(JvmPlatforms.defaultJvmPlatform)?.platformModule ?: psiClass.getNullableModuleInfo()
|
||||
psiClass.getPlatformModuleInfo(JvmPlatforms.unspecifiedJvmPlatform)?.platformModule ?: psiClass.getNullableModuleInfo()
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ fun PsiElement.hasJavaResolutionFacade(): Boolean = this.originalElement.contain
|
||||
fun PsiElement.javaResolutionFacade() =
|
||||
KotlinCacheService.getInstance(project).getResolutionFacadeByFile(
|
||||
this.originalElement.containingFile ?: reportCouldNotCreateJavaFacade(),
|
||||
JvmPlatforms.defaultJvmPlatform
|
||||
JvmPlatforms.unspecifiedJvmPlatform
|
||||
)
|
||||
|
||||
private fun PsiElement.reportCouldNotCreateJavaFacade(): Nothing =
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class TargetPlatformDetector {
|
||||
if (context != null) {
|
||||
PsiFile contextFile = context.getContainingFile();
|
||||
// TODO(dsavvinov): Get default platform with proper target
|
||||
return contextFile instanceof KtFile ? getPlatform((KtFile) contextFile) : JvmPlatforms.INSTANCE.getDefaultJvmPlatform();
|
||||
return contextFile instanceof KtFile ? getPlatform((KtFile) contextFile) : JvmPlatforms.INSTANCE.getUnspecifiedJvmPlatform();
|
||||
}
|
||||
|
||||
if (file.isScript()) {
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.idea.test.SdkAndMockLibraryProjectDescriptor
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
|
||||
abstract class AbstractCompiledKotlinInJavaCompletionTest : KotlinFixtureCompletionBaseTestCase() {
|
||||
override fun getPlatform() = JvmPlatforms.defaultJvmPlatform
|
||||
override fun getPlatform() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
|
||||
override fun getProjectDescriptor() =
|
||||
SdkAndMockLibraryProjectDescriptor(COMPLETION_TEST_DATA_BASE_PATH + "/injava/mockLib", false)
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ abstract class AbstractCompletionIncrementalResolveTest : KotlinLightCodeInsight
|
||||
}
|
||||
|
||||
testCompletion(FileUtil.loadFile(file, true),
|
||||
JvmPlatforms.defaultJvmPlatform,
|
||||
JvmPlatforms.unspecifiedJvmPlatform,
|
||||
{ completionType, count -> myFixture.complete(completionType, count) },
|
||||
additionalValidDirectives = listOf(TYPE_DIRECTIVE_PREFIX, BACKSPACES_DIRECTIVE_PREFIX))
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public abstract class AbstractJvmBasicCompletionTest extends KotlinFixtureComple
|
||||
@NotNull
|
||||
@Override
|
||||
public TargetPlatform getPlatform() {
|
||||
return JvmPlatforms.INSTANCE.getDefaultJvmPlatform();
|
||||
return JvmPlatforms.INSTANCE.getUnspecifiedJvmPlatform();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public abstract class AbstractJvmSmartCompletionTest extends KotlinFixtureComple
|
||||
@NotNull
|
||||
@Override
|
||||
public TargetPlatform getPlatform() {
|
||||
return JvmPlatforms.INSTANCE.getDefaultJvmPlatform();
|
||||
return JvmPlatforms.INSTANCE.getUnspecifiedJvmPlatform();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -21,6 +21,6 @@ abstract class AbstractJvmWithLibBasicCompletionTest : KotlinFixtureCompletionBa
|
||||
return SdkAndMockLibraryProjectDescriptor(TEST_PATH + "/" + getTestName(false) + "Src", false)
|
||||
}
|
||||
|
||||
override fun getPlatform() = JvmPlatforms.defaultJvmPlatform
|
||||
override fun getPlatform() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
override fun defaultCompletionType() = CompletionType.BASIC
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.idea.test.KotlinProjectDescriptorWithFacet
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
|
||||
abstract class AbstractKeywordCompletionTest : KotlinFixtureCompletionBaseTestCase() {
|
||||
override fun getPlatform() = JvmPlatforms.defaultJvmPlatform
|
||||
override fun getPlatform() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
|
||||
override fun defaultCompletionType() = CompletionType.BASIC
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractKotlinSourceInJavaCompletionTest : KotlinFixtureCompletionBaseTestCase() {
|
||||
override fun getPlatform() = JvmPlatforms.defaultJvmPlatform
|
||||
override fun getPlatform() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
|
||||
override fun doTest(testPath: String) {
|
||||
val mockPath = RELATIVE_COMPLETION_TEST_DATA_BASE_PATH + "/injava/mockLib"
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescrip
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
|
||||
abstract class AbstractKotlinStdLibInJavaCompletionTest : KotlinFixtureCompletionBaseTestCase() {
|
||||
override fun getPlatform() = JvmPlatforms.defaultJvmPlatform
|
||||
override fun getPlatform() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||
override fun defaultCompletionType() = CompletionType.BASIC
|
||||
}
|
||||
+1
-1
@@ -14,7 +14,7 @@ abstract class AbstractMultiFileJvmBasicCompletionTest : KotlinCompletionTestCas
|
||||
configureByFile(getTestName(false) + ".kt", "")
|
||||
val shouldFail = testPath.contains("NoSpecifiedType")
|
||||
AstAccessControl.testWithControlledAccessToAst(shouldFail, getFile().getVirtualFile(), getProject(), getTestRootDisposable(), {
|
||||
testCompletion(file.text, JvmPlatforms.defaultJvmPlatform, { completionType, invocationCount ->
|
||||
testCompletion(file.text, JvmPlatforms.unspecifiedJvmPlatform, { completionType, invocationCount ->
|
||||
setType(completionType)
|
||||
complete(invocationCount)
|
||||
myItems
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ abstract class AbstractMultiFileSmartCompletionTest : KotlinCompletionTestCase()
|
||||
protected fun doTest(testPath: String) {
|
||||
configureByFile(getTestName(false) + ".kt", "")
|
||||
AstAccessControl.testWithControlledAccessToAst(false, getFile().getVirtualFile(), getProject(), getTestRootDisposable(), {
|
||||
testCompletion(file.text, JvmPlatforms.defaultJvmPlatform, { completionType, invocationCount ->
|
||||
testCompletion(file.text, JvmPlatforms.unspecifiedJvmPlatform, { completionType, invocationCount ->
|
||||
setType(completionType)
|
||||
complete(invocationCount)
|
||||
myItems
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ object ExpectedCompletionUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private val UNSUPPORTED_PLATFORM_MESSAGE = "Only ${JvmPlatforms.defaultJvmPlatform} and ${JsPlatforms.defaultJsPlatform} platforms are supported"
|
||||
private val UNSUPPORTED_PLATFORM_MESSAGE = "Only ${JvmPlatforms.unspecifiedJvmPlatform} and ${JsPlatforms.defaultJsPlatform} platforms are supported"
|
||||
|
||||
private val EXIST_LINE_PREFIX = "EXIST:"
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ class KotlinGradleModuleConfigurator : KotlinWithGradleConfigurator() {
|
||||
get() = NAME
|
||||
|
||||
override val targetPlatform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
override fun getTargetPlatform() = JvmPlatforms.CompatJvmPlatform
|
||||
|
||||
+2
-5
@@ -48,9 +48,6 @@ import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.util.projectStructure.allModules
|
||||
import org.jetbrains.kotlin.idea.util.projectStructure.sdk
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind
|
||||
import org.jetbrains.kotlin.platform.impl.isCommon
|
||||
import org.jetbrains.kotlin.platform.impl.isJavaScript
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.platform.js.isJs
|
||||
@@ -947,8 +944,8 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
|
||||
checkStableModuleName("project_main", "project", JvmPlatforms.defaultJvmPlatform, isProduction = true)
|
||||
checkStableModuleName("project_test", "project", JvmPlatforms.defaultJvmPlatform, isProduction = false)
|
||||
checkStableModuleName("project_main", "project", JvmPlatforms.unspecifiedJvmPlatform, isProduction = true)
|
||||
checkStableModuleName("project_test", "project", JvmPlatforms.unspecifiedJvmPlatform, isProduction = false)
|
||||
|
||||
assertAllModulesConfigured()
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ object JvmIdePlatformKind : IdePlatformKind<JvmIdePlatformKind>() {
|
||||
return K2JVMCompilerArguments()
|
||||
}
|
||||
|
||||
override val platforms: List<TargetPlatform> = JvmTarget.values().map { ver -> JvmPlatforms.jvmPlatformByTargetVersion(ver) } + listOf(JvmPlatforms.defaultJvmPlatform)
|
||||
override val platforms: List<TargetPlatform> = JvmTarget.values().map { ver -> JvmPlatforms.jvmPlatformByTargetVersion(ver) } + listOf(JvmPlatforms.unspecifiedJvmPlatform)
|
||||
override val defaultPlatform get() = JvmPlatforms.defaultJvmPlatform
|
||||
|
||||
override val argumentsClass get() = K2JVMCompilerArguments::class.java
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ open class KotlinJavaModuleConfigurator protected constructor() : KotlinWithLibr
|
||||
get() = NAME
|
||||
|
||||
override val targetPlatform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
override fun getTargetPlatform() = JvmPlatforms.CompatJvmPlatform
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ private object DebugLabelModuleDescriptor
|
||||
}
|
||||
|
||||
override val platform: TargetPlatform?
|
||||
get() = JvmPlatforms.defaultJvmPlatform
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
|
||||
override fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean): Collection<FqName> {
|
||||
return emptyList()
|
||||
|
||||
@@ -41,7 +41,7 @@ class KotlinTemplatesFactory : ProjectTemplatesFactory() {
|
||||
val result = mutableListOf<ProjectTemplate>(
|
||||
BuilderBasedTemplate(
|
||||
KotlinModuleBuilder(
|
||||
JvmPlatforms.defaultJvmPlatform,
|
||||
JvmPlatforms.unspecifiedJvmPlatform,
|
||||
"JVM | IDEA",
|
||||
"Kotlin project with a JVM target based on the IntelliJ IDEA build system",
|
||||
KotlinIcons.SMALL_LOGO
|
||||
|
||||
@@ -286,7 +286,7 @@ class KotlinBytecodeToolWindow(private val myProject: Project, private val toolW
|
||||
if (!platform.isCommon() && !platform.isJvm()) return null
|
||||
|
||||
val resolutionFacade = KotlinCacheService.getInstance(ktFile.project)
|
||||
.getResolutionFacadeByFile(ktFile, JvmPlatforms.defaultJvmPlatform)
|
||||
.getResolutionFacadeByFile(ktFile, JvmPlatforms.unspecifiedJvmPlatform)
|
||||
?: return null
|
||||
|
||||
val bindingContextForFile = resolutionFacade.analyzeWithAllCompilerChecks(listOf(ktFile)).bindingContext
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ class KotlinJavaMavenConfigurator : KotlinMavenConfigurator(
|
||||
}
|
||||
|
||||
override val targetPlatform: TargetPlatform
|
||||
get() = JvmPlatforms.defaultJvmPlatform
|
||||
get() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
override fun getTargetPlatform() = JvmPlatforms.CompatJvmPlatform
|
||||
|
||||
@@ -2529,7 +2529,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
}
|
||||
|
||||
with(facetSettings("my-jvm-module")) {
|
||||
Assert.assertEquals(JvmPlatforms.defaultJvmPlatform, platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, platform)
|
||||
Assert.assertEquals(listOf("my-common-module1", "my-common-module2"), implementedModuleNames)
|
||||
}
|
||||
|
||||
@@ -2974,8 +2974,8 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
|
||||
assertImporterStatePresent()
|
||||
|
||||
checkStableModuleName("project", "project", JvmPlatforms.defaultJvmPlatform, isProduction = true)
|
||||
checkStableModuleName("project", "project", JvmPlatforms.defaultJvmPlatform, isProduction = false)
|
||||
checkStableModuleName("project", "project", JvmPlatforms.unspecifiedJvmPlatform, isProduction = true)
|
||||
checkStableModuleName("project", "project", JvmPlatforms.unspecifiedJvmPlatform, isProduction = false)
|
||||
}
|
||||
|
||||
fun testStableModuleNameWhileUsngMaven_JS() {
|
||||
|
||||
+1
-1
@@ -365,7 +365,7 @@ class KotlinElementActionsFactory : JvmElementActionsFactory() {
|
||||
if (!modifierBuilder.isValid) return emptyList()
|
||||
|
||||
val resolutionFacade = KotlinCacheService.getInstance(targetContainer.project)
|
||||
.getResolutionFacadeByFile(targetContainer.containingFile, JvmPlatforms.defaultJvmPlatform) ?: return emptyList()
|
||||
.getResolutionFacadeByFile(targetContainer.containingFile, JvmPlatforms.unspecifiedJvmPlatform) ?: return emptyList()
|
||||
val returnTypeInfo = request.returnType.toKotlinTypeInfo(resolutionFacade)
|
||||
val parameters = request.parameters as List<Pair<SuggestedNameInfo, List<ExpectedType>>>
|
||||
val parameterInfos = parameters.map { (suggestedNames, expectedTypes) ->
|
||||
|
||||
@@ -58,7 +58,7 @@ class KotlinNonJvmSourceRootConverterProvider : ConverterProvider("kotlin-non-jv
|
||||
|
||||
// TODO(dsavvinov): review how it behaves in HMPP environment
|
||||
private val PLATFORM_TO_STDLIB_DETECTORS: Map<TargetPlatform, (Array<VirtualFile>) -> Boolean> = mapOf(
|
||||
JvmPlatforms.defaultJvmPlatform to { roots: Array<VirtualFile> -> JavaRuntimeDetectionUtil.getRuntimeJar(roots.toList()) != null },
|
||||
JvmPlatforms.unspecifiedJvmPlatform to { roots: Array<VirtualFile> -> JavaRuntimeDetectionUtil.getRuntimeJar(roots.toList()) != null },
|
||||
JsPlatforms.defaultJsPlatform to { roots: Array<VirtualFile> -> JsLibraryStdDetectionUtil.getJsStdLibJar(roots.toList()) != null },
|
||||
CommonPlatforms.defaultCommonPlatform to { roots: Array<VirtualFile> -> getLibraryJar(roots, PathUtil.KOTLIN_STDLIB_COMMON_JAR_PATTERN) != null }
|
||||
)
|
||||
@@ -167,7 +167,7 @@ class KotlinNonJvmSourceRootConverterProvider : ConverterProvider("kotlin-non-jv
|
||||
private fun ModuleSettings.detectPlatform(): TargetPlatform {
|
||||
return detectPlatformByFacet()
|
||||
?: detectPlatformByDependencies()
|
||||
?: JvmPlatforms.defaultJvmPlatform
|
||||
?: JvmPlatforms.unspecifiedJvmPlatform
|
||||
}
|
||||
|
||||
private fun ModuleSettings.getSourceFolderElements(): List<Element> {
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ abstract class AbstractCodeInsightActionTest : KotlinLightCodeInsightFixtureTest
|
||||
val targetPlatformName = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// PLATFORM: ")
|
||||
if (targetPlatformName != null) {
|
||||
val targetPlatform = when (targetPlatformName) {
|
||||
"JVM" -> JvmPlatforms.defaultJvmPlatform
|
||||
"JVM" -> JvmPlatforms.unspecifiedJvmPlatform
|
||||
"JavaScript" -> JsPlatforms.defaultJsPlatform
|
||||
"Common" -> CommonPlatforms.defaultCommonPlatform
|
||||
else -> error("Unexpected platform name: $targetPlatformName")
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ class CodeFragmentCompletionInLibraryTest : AbstractJvmBasicCompletionTest() {
|
||||
setupFixtureByCodeFragment(fragmentText)
|
||||
val directives = completionDirectives.map { "//$it" }.joinToString(separator = "\n")
|
||||
testCompletion(directives,
|
||||
JvmPlatforms.defaultJvmPlatform, { completionType, count -> myFixture.complete(completionType, count) })
|
||||
JvmPlatforms.unspecifiedJvmPlatform, { completionType, count -> myFixture.complete(completionType, count) })
|
||||
}
|
||||
|
||||
private fun setupFixtureByCodeFragment(fragmentText: String) {
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.intellij.openapi.roots.ModuleRootModificationUtil
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.idea.framework.CommonLibraryKind
|
||||
import org.jetbrains.kotlin.idea.framework.JSLibraryKind
|
||||
import org.jetbrains.kotlin.idea.stubs.AbstractMultiModuleTest
|
||||
|
||||
@@ -37,7 +37,7 @@ abstract class AbstractIdeReplCompletionTest : KotlinFixtureCompletionBaseTestCa
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
override fun getPlatform() = JvmPlatforms.defaultJvmPlatform
|
||||
override fun getPlatform() = JvmPlatforms.unspecifiedJvmPlatform
|
||||
override fun defaultCompletionType() = CompletionType.BASIC
|
||||
|
||||
override fun doTest(testPath: String) {
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ abstract class AbstractScriptConfigurationCompletionTest : AbstractScriptConfigu
|
||||
configureScriptFile(path)
|
||||
testCompletion(
|
||||
file.text,
|
||||
JvmPlatforms.defaultJvmPlatform,
|
||||
JvmPlatforms.unspecifiedJvmPlatform,
|
||||
additionalValidDirectives = switches,
|
||||
complete = { completionType, count ->
|
||||
setType(completionType)
|
||||
|
||||
Reference in New Issue
Block a user