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:
Dmitry Savvinov
2019-05-23 18:31:42 +03:00
parent ef39e2a68f
commit 8997fa52df
41 changed files with 57 additions and 57 deletions
@@ -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 {